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.focus = focus
window.toTop = toTop
window.listener = listener
}

View File

@ -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))