vue3 watch

发布时间 2023-11-22 10:54:16作者: 进阶的哈姆雷特
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);
        });
    }
});