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