![](https://img2023.cnblogs.com/blog/1327671/202311/1327671-20231122105459697-1210825578.png)
https://cn.vuejs.org/api/reactivity-core.html#watch:~:text=当使用 getter 函数作为源时,回调只在此函数的返回值变化时才会触发。如果你想让回调在深层级变更时也能触发,你需要使用 { deep%3A true } 强制侦听器进入深层级模式。在深层级模式时,如果回调函数由于深层级的变更而被触发,那么新值和旧值将是同一个对象。
const filterCommandList = computed(() => {
timerList.value.forEach((item) => clearInterval(item));
timerList.value = [];
let data = repeatReminderList.value;
return data.map((row) => {
row.close = false;
row.lastTime = 0;
row.countDown = null;
countdown(row);
return row;
});
});
watch(
() => filterCommandList.value,
(newval, oldval) => {
console.log(`ReminderTimerQueue >> 当前循环队列: `, newval);
}
);
watch(repeatReminderList.value, (val) => {
debugger;
if (val.length > 0) {
repeatReminderList.value.map((row) => {
row.countDown = null;
countdown(row);
});
}
});