Demo:保存视图数据的逻辑增加防抖操作,优化性能

This commit is contained in:
wanglin2 2023-08-08 16:29:29 +08:00
parent 86b184d5c1
commit 69faa8bb3e

View File

@ -122,7 +122,8 @@ export default {
return { return {
mindMap: null, mindMap: null,
mindMapData: null, mindMapData: null,
prevImg: '' prevImg: '',
storeConfigTimer: null
} }
}, },
computed: { computed: {
@ -186,9 +187,12 @@ export default {
storeData(data) storeData(data)
}) })
this.$bus.$on('view_data_change', data => { this.$bus.$on('view_data_change', data => {
storeConfig({ clearTimeout(this.storeConfigTimer)
view: data this.storeConfigTimer = setTimeout(() => {
}) storeConfig({
view: data
})
}, 1000)
}) })
}, },