mirror of
https://github.com/ZiuChen/ClipboardManager.git
synced 2025-06-27 20:42:42 +08:00
fix: 修复清空本地数据时内存数据未及时清空的问题
This commit is contained in:
parent
85291cd2cf
commit
1e408a5770
@ -22,6 +22,11 @@ export default function initPlugin() {
|
||||
this.dataBase = {}
|
||||
this.createTime = d.getTime()
|
||||
this.updateTime = d.getTime()
|
||||
this.defaultDB = {
|
||||
data: [],
|
||||
createTime: this.createTime,
|
||||
updateTime: this.updateTime
|
||||
}
|
||||
}
|
||||
init() {
|
||||
const isExist = existsSync(this.path)
|
||||
@ -46,13 +51,8 @@ export default function initPlugin() {
|
||||
}
|
||||
return
|
||||
}
|
||||
const defaultDB = {
|
||||
data: [],
|
||||
createTime: this.createTime,
|
||||
updateTime: this.updateTime
|
||||
}
|
||||
this.dataBase = defaultDB
|
||||
this.updateDataBaseLocal(defaultDB)
|
||||
this.dataBase = this.defaultDB
|
||||
this.updateDataBaseLocal(this.defaultDB)
|
||||
}
|
||||
watchDataBaseUpdate() {
|
||||
watch(this.path, (eventType, filename) => {
|
||||
@ -101,9 +101,8 @@ export default function initPlugin() {
|
||||
this.updateDataBaseLocal()
|
||||
}
|
||||
emptyDataBase() {
|
||||
this.dataBase.data = []
|
||||
this.updateDataBase()
|
||||
this.updateDataBaseLocal()
|
||||
window.db.dataBase.data = []
|
||||
this.updateDataBaseLocal(this.defaultDB)
|
||||
}
|
||||
filterDataBaseViaId(id) {
|
||||
return this.dataBase.data.filter((item) => item.id === id)
|
||||
|
@ -169,7 +169,7 @@ const updateShowList = (type, toTop = true) => {
|
||||
|
||||
const restoreDataBase = () => {
|
||||
// 清空数据库
|
||||
ElMessageBox.confirm('确定要清空剪贴板记录吗', '提示', {
|
||||
ElMessageBox.confirm('即将清空剪贴板记录(包括收藏内容)', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
|
Loading…
x
Reference in New Issue
Block a user