Skip to content

Commit

Permalink
修复设置页面触发保存频率过高的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Nov 9, 2018
1 parent cb1c1a7 commit d97dc98
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion front/src/views/Setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@
import FileChoose from '../components/FileChoose'
import { getConfig, setConfig } from '../common/native.js'
let debounceTimer
export default {
name: 'setting',
components: {
Expand Down Expand Up @@ -184,7 +186,13 @@ export default {
handler(nowVal, oldVal) {
//不是首次加载触发
if (Object.keys(oldVal.downConfig).length !== 0) {
this.setConfig()
if (debounceTimer) {
clearTimeout(debounceTimer)
}
debounceTimer = setTimeout(() => {
debounceTimer = null
this.setConfig()
}, 300)
}
},
deep: true
Expand All @@ -200,6 +208,7 @@ export default {
this.rules['appConfig.proxyConfig.proxyType'] = null
this.rules['appConfig.proxyConfig.host'] = null
this.rules['appConfig.proxyConfig.port'] = null
this.setConfig()
}
},
async getConfig() {
Expand Down

0 comments on commit d97dc98

Please sign in to comment.