mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-12 02:20:46 +08:00
@@ -237,9 +237,8 @@ export default class extends Vue {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
const file = this.$db.get('uploaded').getById(id)
|
||||
// @ts-ignore
|
||||
this.$db.read().get('uploaded').removeById(id).write()
|
||||
const file = this.$db.getById('uploaded', id)
|
||||
this.$db.removeById('uploaded', id)
|
||||
ipcRenderer.send('removeFiles', [file])
|
||||
const obj = {
|
||||
title: '操作结果',
|
||||
@@ -250,7 +249,8 @@ export default class extends Vue {
|
||||
return true
|
||||
}
|
||||
this.getGallery()
|
||||
}).catch(() => {
|
||||
}).catch((e) => {
|
||||
console.log(e)
|
||||
return true
|
||||
})
|
||||
}
|
||||
@@ -302,11 +302,9 @@ export default class extends Vue {
|
||||
let files: ImgInfo[] = []
|
||||
Object.keys(this.choosedList).forEach(key => {
|
||||
if (this.choosedList[key]) {
|
||||
// @ts-ignore
|
||||
const file = this.$db.read().get('uploaded').getById(key).value()
|
||||
const file = this.$db.getById('uploaded', key)
|
||||
files.push(file)
|
||||
// @ts-ignore
|
||||
this.$db.read().get('uploaded').removeById(key).write()
|
||||
this.$db.removeById('uploaded', key)
|
||||
}
|
||||
})
|
||||
this.choosedList = {}
|
||||
@@ -332,8 +330,7 @@ export default class extends Vue {
|
||||
// choosedList -> { [id]: true or false }; true means choosed. false means not choosed.
|
||||
Object.keys(this.choosedList).forEach(key => {
|
||||
if (this.choosedList[key]) {
|
||||
// @ts-ignore
|
||||
const item = this.$db.read().get('uploaded').getById(key).value()
|
||||
const item = this.$db.getById('uploaded', key)
|
||||
copyString += pasteStyle(style, item) + '\n'
|
||||
this.choosedList[key] = false
|
||||
}
|
||||
|
||||
@@ -61,6 +61,14 @@ class DB {
|
||||
unset (key: string, value: any): boolean {
|
||||
return this.read().get(key).unset(value).value()
|
||||
}
|
||||
getById (key: string, id: string) {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).getById(id).value()
|
||||
}
|
||||
removeById (key: string, id: string) {
|
||||
// @ts-ignore
|
||||
return this.read().get(key).removeById(id).write()
|
||||
}
|
||||
}
|
||||
|
||||
export default new DB()
|
||||
|
||||
Reference in New Issue
Block a user