修复刷新配置会被重置的bug

This commit is contained in:
xu_yanfeng 2025-05-08 14:55:49 +08:00
parent 5cc983d4ae
commit a0fc514ac9
3 changed files with 14 additions and 8 deletions

View File

@ -116,10 +116,10 @@ export default defineComponent({
Bus.off(BusMsg.ShowPlace, funcShowPlace); Bus.off(BusMsg.ShowPlace, funcShowPlace);
Bus.off(BusMsg.EnableSchedule, funcEnableSchedule); Bus.off(BusMsg.EnableSchedule, funcEnableSchedule);
bridge.off(Msg.InspectNode, onInspectNode); bridge.off(Msg.InspectNode, onInspectNode);
timer.clean(); timer.destroy();
}); });
function updateTree() { function updateTree() {
console.log("update tree info"); // console.log("update tree info");
const id = toRaw(frameID.value); const id = toRaw(frameID.value);
bridge.send(Msg.RequstTreeInfo, { frameID: id } as RequestTreeInfoData); bridge.send(Msg.RequstTreeInfo, { frameID: id } as RequestTreeInfoData);
} }

View File

@ -84,7 +84,7 @@ export default defineComponent({
Bus.off(BusMsg.ChangeContent, changeContent); Bus.off(BusMsg.ChangeContent, changeContent);
Bus.off(BusMsg.SelectNode, funSelectNode); Bus.off(BusMsg.SelectNode, funSelectNode);
Bus.off(BusMsg.EnableSchedule, funcEnableSchedule); Bus.off(BusMsg.EnableSchedule, funcEnableSchedule);
timer.clean(); timer.destroy();
}); });
bridge.on(Msg.ResponseSupport, (event: PluginEvent) => { bridge.on(Msg.ResponseSupport, (event: PluginEvent) => {
let data: ResponseSupportData = event.data; let data: ResponseSupportData = event.data;

View File

@ -18,12 +18,18 @@ export class Timer {
this.onWork && this.onWork(); this.onWork && this.onWork();
} }
} }
clean() { destroy(): boolean {
if (this.timer === null) { if (this.timer === null) {
return; return false;
} else {
clearInterval(this.timer);
this.timer = null;
return true;
}
}
clean() {
if (this.destroy()) {
this.onClean && this.onClean();
} }
clearInterval(this.timer);
this.timer = null;
this.onClean && this.onClean();
} }
} }