mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-30 14:12:52 +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.focus = focus
|
||||
window.toTop = toTop
|
||||
window.listener = listener
|
||||
}
|
||||
|
@ -226,17 +226,10 @@ onMounted(() => {
|
||||
updateShowList(activeTab.value)
|
||||
|
||||
// 定期检查更新
|
||||
let prev = {}
|
||||
setInterval(() => {
|
||||
const now = window.db.dataBase.data[0]
|
||||
if (prev?.id === now?.id) {
|
||||
} else {
|
||||
// 有更新
|
||||
window.listener.on('change', () => {
|
||||
list.value = window.db.dataBase.data
|
||||
updateShowList(activeTab.value)
|
||||
prev = now
|
||||
}
|
||||
}, 800)
|
||||
})
|
||||
|
||||
// 监听搜索框
|
||||
watch(filterText, (val) => updateShowList(activeTab.value))
|
||||
|
Loading…
x
Reference in New Issue
Block a user