feat: 视图层从listener获取剪贴板更新事件

This commit is contained in:
ZiuChen
2022-09-19 18:37:48 +08:00
parent 9177af7513
commit fc6f1680bf
2 changed files with 5 additions and 11 deletions

View File

@@ -220,4 +220,5 @@ export default function initPlugin() {
window.createFile = createFile window.createFile = createFile
window.focus = focus window.focus = focus
window.toTop = toTop window.toTop = toTop
window.listener = listener
} }

View File

@@ -226,17 +226,10 @@ onMounted(() => {
updateShowList(activeTab.value) updateShowList(activeTab.value)
// 定期检查更新 // 定期检查更新
let prev = {} window.listener.on('change', () => {
setInterval(() => { list.value = window.db.dataBase.data
const now = window.db.dataBase.data[0] updateShowList(activeTab.value)
if (prev?.id === now?.id) { })
} else {
// 有更新
list.value = window.db.dataBase.data
updateShowList(activeTab.value)
prev = now
}
}, 800)
// 监听搜索框 // 监听搜索框
watch(filterText, (val) => updateShowList(activeTab.value)) watch(filterText, (val) => updateShowList(activeTab.value))