画布清除

This commit is contained in:
lzp
2026-03-11 17:02:32 +08:00
parent cbebf804bd
commit adf562bbe4
7 changed files with 19 additions and 2 deletions

View File

@@ -249,7 +249,11 @@
}) })
onBeforeMount(() => { onBeforeMount(() => {
eventManager.removeEvents() // 移除事件 stateManager.dispose()
eventManager.dispose()
flowManager.dispose()
nodeManager.dispose()
toolManager.dispose()
}) })
</script> </script>
<style lang="less"> <style lang="less">

View File

@@ -81,4 +81,7 @@ export class EventManager {
// document.removeEventListener('copy', this.handleCopy.bind(this)) // document.removeEventListener('copy', this.handleCopy.bind(this))
document.removeEventListener('keydown', this.handleKeyDown.bind(this)) document.removeEventListener('keydown', this.handleKeyDown.bind(this))
} }
dispose() {
this.removeEvents()
}
} }

View File

@@ -23,4 +23,5 @@ export class FlowManager {
return this.vueFlow.value.getNodes?.find((v) => v.data.superiorID === id) return this.vueFlow.value.getNodes?.find((v) => v.data.superiorID === id)
} }
dispose() {}
} }

View File

@@ -30,4 +30,8 @@ export class GenerateManager {
}) })
} }
dispose() {
this.taskIds = []
}
} }

View File

@@ -133,4 +133,5 @@ export class NodeManager {
delete node_.data?.disableDelete delete node_.data?.disableDelete
this.stateManager.addNode(node_) this.stateManager.addNode(node_)
} }
dispose() {}
} }

View File

@@ -183,4 +183,8 @@ export class StateManager {
this.nodes.value = JSON.parse(state.nodes) this.nodes.value = JSON.parse(state.nodes)
} }
dispose() {
this.historyList.value = []
this.historyIndex.value = 0
}
} }

View File

@@ -43,5 +43,5 @@ export class ToolManager {
this.stateManager.setPanOnDrag(!!tool.panOnDrag) this.stateManager.setPanOnDrag(!!tool.panOnDrag)
this.stateManager.setCursor(tool.cursor || "") this.stateManager.setCursor(tool.cursor || "")
} }
dispose() {}
} }