$watchVue 有可能$refs吗?
我想针对嵌套在当前Vue实例内但ready回调内的子组件设置逻辑,该子组件$refs.childcomponent最初是undefined在处理过程中使用的。
内 ready()
this.$watch('$refs', function() {
console.log("not firing");
}, { deep: true });
结果:错误:超出最大调用堆栈
watch 实例的属性
watch: {
'$refs': {
handler: function() { console.log("hit"); },
deep: true
}
}
结果:什么都没有。
不,$ refs不是被动的,监视将无法工作。