mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-07-01 06:32:53 +08:00
feat: 视图层从listener获取剪贴板更新事件
This commit is contained in:
parent
9177af7513
commit
fc6f1680bf
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user