Skip to content

Vue3使用Watch监听多个参数

watch监听多个响应式变量写法

js
const test1 = ref(1)
const test2 = ref(2)
watch(() => [test1.value, test2.value], ([new1, new2], [old1, old2]) => {
  
})
/src/technology/dateblog/2025/04/20250408-vue3%E4%BD%BF%E7%94%A8watch%E7%9B%91%E5%90%AC%E5%A4%9A%E4%B8%AA%E5%8F%82%E6%95%B0.html