can't watch object change when changing value in self funtion
Version
3.2.19
Reproduction link
Steps to reproduce
can't watch object change when changing value in self funtion 在内部方法中改变变量值,watch和computed无效
const a:any = ref(null)
const test = () => {
const a :any= {}
a.time = 0
a.setValue = function () {
a.time = a.time + 1
}
return a
}
a.value = test()
onMounted(() => {
setTimeout(() => {
a.value.setValue()
},2000)
})
watch(() => a.value,() => {
console.log('value change');
},{
deep:true,
})
What is expected?
log 'value change'
What is actually happening?
log nothing