为什么要在update里再次执行一遍oldBinding.value
fxxjdedd opened this issue · 2 comments
fxxjdedd commented
Line 21 in 20076f2
我觉的这一是个很常见的使用场景,这种写法在每次update时,v-ref的回调函数会是一个全新的函数,然后compRef就会再次设置为null
<Dialog v-ref="comp => this.compRef = comp"></Dialog>
tangjinzhou commented
- 为了释放内存
场景:<Dialog v-ref="this.refA"></Dialog>更改成<Dialog v-ref="this.refB"></Dialog>
这时要把 refA中的值给设置null - this.compRef 不应该是响应式数据,也不能是响应式数据,也没必要是响应式数据
设置null没什么问题
fxxjdedd commented
多谢回复,我理解您的意思了。