{
this.getDefaultPicBed()
})
+ this.getPicBeds()
+ this.$electron.ipcRenderer.on('getPicBeds', (event, picBeds) => {
+ this.picBed = picBeds
+ this.getDefaultPicBed()
+ })
},
watch: {
progress (val) {
@@ -100,6 +106,7 @@ export default {
beforeDestroy () {
this.$electron.ipcRenderer.removeAllListeners('uploadProgress')
this.$electron.ipcRenderer.removeAllListeners('syncPicBed')
+ this.$electron.ipcRenderer.removeAllListeners('getPicBeds')
},
methods: {
onDrop (e) {
@@ -136,11 +143,14 @@ export default {
},
getDefaultPicBed () {
const current = this.$db.read().get('picBed.current').value()
- this.$picBed.forEach(item => {
+ this.picBed.forEach(item => {
if (item.type === current) {
- this.picBed = item.name
+ this.picBedName = item.name
}
})
+ },
+ getPicBeds () {
+ this.$electron.ipcRenderer.send('getPicBeds')
}
}
}
diff --git a/src/renderer/pages/picbeds/Others.vue b/src/renderer/pages/picbeds/Others.vue
index e0d976e..32f4872 100644
--- a/src/renderer/pages/picbeds/Others.vue
+++ b/src/renderer/pages/picbeds/Others.vue
@@ -3,55 +3,98 @@
- Imgur图床设置
+ {{ picBedName }}设置
-
-
-
-
-
-
-
+
- 确定
+ 确定
设为默认图床
-
+
+
\ No newline at end of file
diff --git a/src/renderer/utils/ConfirmButtonMixin.js b/src/renderer/utils/ConfirmButtonMixin.js
index 43713c6..81940dd 100644
--- a/src/renderer/utils/ConfirmButtonMixin.js
+++ b/src/renderer/utils/ConfirmButtonMixin.js
@@ -1,14 +1,13 @@
-import db from '~/datastore'
export default {
name: '',
data () {
return {
- defaultPicBed: db.read().get('picBed.current').value()
+ defaultPicBed: this.$db.read().get('picBed.current').value()
}
},
methods: {
setDefaultPicBed (type) {
- db.read().set('picBed.current', type).write()
+ this.$db.read().set('picBed.current', type).write()
this.defaultPicBed = type
this.$electron.ipcRenderer.send('updateDefaultPicBed', type)
const successNotification = new window.Notification('设置默认图床', {