添加数据保存节流
parent
48e1da128d
commit
967093328f
|
@ -23,6 +23,7 @@ import { mapMutations, mapGetters, mapActions } from 'vuex'
|
||||||
import { rendererOn, rendererSend } from '../common/ipc'
|
import { rendererOn, rendererSend } from '../common/ipc'
|
||||||
import { isLinux } from '../common/utils'
|
import { isLinux } from '../common/utils'
|
||||||
import music from './utils/music'
|
import music from './utils/music'
|
||||||
|
import { throttle } from './utils'
|
||||||
window.ELECTRON_DISABLE_SECURITY_WARNINGS = process.env.ELECTRON_DISABLE_SECURITY_WARNINGS
|
window.ELECTRON_DISABLE_SECURITY_WARNINGS = process.env.ELECTRON_DISABLE_SECURITY_WARNINGS
|
||||||
dnscache({
|
dnscache({
|
||||||
enable: true,
|
enable: true,
|
||||||
|
@ -50,6 +51,20 @@ export default {
|
||||||
downloadStatus: 'downloadStatus',
|
downloadStatus: 'downloadStatus',
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
this.saveSetting = throttle(n => {
|
||||||
|
this.electronStore.set('setting', n)
|
||||||
|
})
|
||||||
|
this.saveDefaultList = throttle(n => {
|
||||||
|
this.electronStore.set('list.defaultList', n)
|
||||||
|
}, 500)
|
||||||
|
this.saveLoveList = throttle(n => {
|
||||||
|
this.electronStore.set('list.loveList', n)
|
||||||
|
}, 500)
|
||||||
|
this.saveDownloadList = throttle(n => {
|
||||||
|
this.electronStore.set('download.list', n)
|
||||||
|
}, 1000)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
document.body.classList.add(this.isLinux ? 'noTransparent' : 'transparent')
|
document.body.classList.add(this.isLinux ? 'noTransparent' : 'transparent')
|
||||||
this.init()
|
this.init()
|
||||||
|
@ -57,27 +72,25 @@ export default {
|
||||||
watch: {
|
watch: {
|
||||||
setting: {
|
setting: {
|
||||||
handler(n) {
|
handler(n) {
|
||||||
this.electronStore.set('setting', n)
|
this.saveSetting(n)
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
defaultList: {
|
defaultList: {
|
||||||
handler(n) {
|
handler(n) {
|
||||||
// console.log(n)
|
this.saveDefaultList(n)
|
||||||
this.electronStore.set('list.defaultList', n)
|
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
loveList: {
|
loveList: {
|
||||||
handler(n) {
|
handler(n) {
|
||||||
// console.log(n)
|
this.saveLoveList(n)
|
||||||
this.electronStore.set('list.loveList', n)
|
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
downloadList: {
|
downloadList: {
|
||||||
handler(n) {
|
handler(n) {
|
||||||
this.electronStore.set('download.list', n)
|
this.saveDownloadList(n)
|
||||||
},
|
},
|
||||||
deep: true,
|
deep: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue