perf: ♻️ Optimize autoConnect historical devices

This commit is contained in:
viarotel 2023-11-16 11:33:52 +08:00
parent a57b847dd9
commit 755a130ec0
2 changed files with 29 additions and 5 deletions

View File

@ -8,7 +8,12 @@
:name="item.prop"
lazy
>
<component :is="item.prop" v-if="isRender(item)" :ref="item.prop" />
<component
:is="item.prop"
v-if="isRender(item)"
:ref="item.prop"
:re-render="reRender"
/>
</el-tab-pane>
</el-tabs>
</div>
@ -44,6 +49,7 @@ export default {
activeTab: 'Device',
renderTab: '',
rendered: true,
renderSign: false,
}
},
created() {
@ -88,12 +94,24 @@ export default {
this.renderTab = ''
},
reRenderPost() {
this.renderSign = true
},
async onTabChange(prop) {
if (!this.renderSign) {
return false
}
switch (prop) {
case 'Device':
this.reRender()
break
case 'Preference':
this.reRender()
break
}
this.renderSign = false
},
},
}

View File

@ -264,6 +264,11 @@ export default {
this.$store.theme.update(value)
},
},
'preferenceData.adbPath': {
handler() {
this.handleDevices()
},
},
// global
'scopeList': {
handler(value) {
@ -283,12 +288,13 @@ export default {
},
},
created() {
this.handleSave = debounce(this.handleSave, 1000, {
leading: false,
trailing: true,
})
this.handleSave = debounce(this.handleSave, 1000)
this.handleDevices = debounce(this.handleDevices, 1000)
},
methods: {
handleDevices() {
this.$root.reRenderPost()
},
subModel(item) {
const children = item?.children || {}
const value = {}