我正在使用日期选择器组件库,我想看看该组件的属性何时更改.
我试过这个:
watch: {
'$refs.picker.popupVisible': {
handler (new_value) {
console.log('executed')
},
deep: true
}
}
Run Code Online (Sandbox Code Playgroud)
这个:
computed: {
picker () {
console.log(this.$refs.picker.popupVisible)
return this.$refs.picker.popupVisible
}
}
Run Code Online (Sandbox Code Playgroud)
我知道解决方案将是一个vue.js hack,因为这不是正确的方法.如果我有权访问子组件,我会向父母发出en事件但不幸的是我没有.