mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 11:59:40 +08:00
Finished: dynamic sync default picbed in menu
This commit is contained in:
@@ -48,8 +48,7 @@ export default {
|
||||
this.showError = true
|
||||
}
|
||||
})
|
||||
this.$electron.ipcRenderer.send('getPicBeds')
|
||||
this.$electron.ipcRenderer.on('getPicBeds', this.getPicBeds)
|
||||
this.getPicBeds()
|
||||
},
|
||||
mounted () {
|
||||
window.addEventListener('mousedown', this.handleMouseDown, false)
|
||||
@@ -70,8 +69,8 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getPicBeds (event, picBeds) {
|
||||
this.picBed = picBeds
|
||||
getPicBeds () {
|
||||
this.picBed = this.$electron.ipcRenderer.sendSync('getPicBeds')
|
||||
this.buildMenu()
|
||||
},
|
||||
onDrop (e) {
|
||||
@@ -123,16 +122,7 @@ export default {
|
||||
if (e.button === 0) { // left mouse
|
||||
this.openUploadWindow()
|
||||
} else {
|
||||
let _this = this
|
||||
const types = this.picBed.map(item => item.type)
|
||||
let submenuItem = this.menu.items[1].submenu.items
|
||||
submenuItem.forEach((item, index) => {
|
||||
const result = _this.$db.read().get('picBed.current').value() === types[index]
|
||||
if (result) {
|
||||
item.click()
|
||||
return true
|
||||
}
|
||||
})
|
||||
this.getPicBeds()
|
||||
this.openContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,6 @@ export default {
|
||||
setDefaultPicBed (type) {
|
||||
this.$db.read().set('picBed.current', type).write()
|
||||
this.defaultPicBed = type
|
||||
this.$electron.ipcRenderer.send('updateDefaultPicBed', type)
|
||||
const successNotification = new window.Notification('设置默认图床', {
|
||||
body: '设置成功'
|
||||
})
|
||||
|
||||
@@ -9,7 +9,6 @@ export default {
|
||||
setDefaultPicBed (type) {
|
||||
this.$db.read().set('picBed.current', type).write()
|
||||
this.defaultPicBed = type
|
||||
this.$electron.ipcRenderer.send('updateDefaultPicBed', type)
|
||||
const successNotification = new window.Notification('设置默认图床', {
|
||||
body: '设置成功'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user