From fc6f1680bfc0b39a3337d7f498740305c24343fd Mon Sep 17 00:00:00 2001 From: ZiuChen <457353192@qq.com> Date: Mon, 19 Sep 2022 18:37:48 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E5=B1=82=E4=BB=8Elis?= =?UTF-8?q?tener=E8=8E=B7=E5=8F=96=E5=89=AA=E8=B4=B4=E6=9D=BF=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/global/initPlugin.js | 1 + src/views/Main.vue | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/src/global/initPlugin.js b/src/global/initPlugin.js index e3cfee2..1250dae 100644 --- a/src/global/initPlugin.js +++ b/src/global/initPlugin.js @@ -220,4 +220,5 @@ export default function initPlugin() { window.createFile = createFile window.focus = focus window.toTop = toTop + window.listener = listener } diff --git a/src/views/Main.vue b/src/views/Main.vue index 251b750..1f0aee1 100644 --- a/src/views/Main.vue +++ b/src/views/Main.vue @@ -226,17 +226,10 @@ onMounted(() => { updateShowList(activeTab.value) // 定期检查更新 - let prev = {} - setInterval(() => { - const now = window.db.dataBase.data[0] - if (prev?.id === now?.id) { - } else { - // 有更新 - list.value = window.db.dataBase.data - updateShowList(activeTab.value) - prev = now - } - }, 800) + window.listener.on('change', () => { + list.value = window.db.dataBase.data + updateShowList(activeTab.value) + }) // 监听搜索框 watch(filterText, (val) => updateShowList(activeTab.value))