结论:
当第一个参数为非函数时,传入对象,否则传入值
1.ref
setup(){
const count = ref(22)
//有效
watch(count,()=>{
console.log("watch",count)
})
//无效
watch(count.value,()=>{
console.log("watch",count)
})
//有效
watch(()=>count.value,()=>{
console.log("watch",count)
})
//无效
watch(()=>count,()=>{
console.log("watch",count)
})
}