fix:修改 diagram 泄露相关问题
This commit is contained in:
@@ -312,6 +312,7 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Store as le5leStore } from 'le5le-store'
|
||||
import { Topology, registerNode } from '@topology/core'
|
||||
import imgDefault from '@/components/common/project/L5/services/img'
|
||||
import {
|
||||
@@ -2236,6 +2237,42 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (this.timer) {
|
||||
clearInterval(this.timer)
|
||||
this.timer = null
|
||||
}
|
||||
if (this.timer4) {
|
||||
clearInterval(this.timer4)
|
||||
this.timer4 = null
|
||||
}
|
||||
if (getTopology(this.topologyIndex)) {
|
||||
getTopology(this.topologyIndex).open({ pens: [] })
|
||||
getTopology(this.topologyIndex).off('contextmenu', this.onContextMenu)
|
||||
getTopology(this.topologyIndex).destroy()
|
||||
const StoreData = le5leStore.get()
|
||||
const arr = []
|
||||
Object.keys(StoreData).forEach(key => {
|
||||
const id = key.split('-')[0]
|
||||
arr.push(id)
|
||||
if (getTopology(this.topologyIndex).id == id) {
|
||||
le5leStore.set(key, null)
|
||||
delete StoreData[key]
|
||||
}
|
||||
})
|
||||
console.log(this.$loadsh.uniq(arr))
|
||||
console.log(le5leStore.get())
|
||||
Object.keys(getTopology(this.topologyIndex)).forEach(key => {
|
||||
getTopology(this.topologyIndex)[key] = null
|
||||
})
|
||||
setTopology(this.topologyIndex, null)
|
||||
}
|
||||
if (document.getElementById('topology-canvas' + this.topologyIndexF)) {
|
||||
document.getElementById('topology-canvas' + this.topologyIndexF).removeEventListener('mousemove', this.canvasMove)
|
||||
}
|
||||
window.removeEventListener('resize', this.winResize)
|
||||
window.removeEventListener('click', this.contextmenuNone)
|
||||
},
|
||||
destroyed () {
|
||||
if (getTopology(this.topologyIndex)) {
|
||||
getTopology(this.topologyIndex).destroy()
|
||||
|
||||
@@ -336,9 +336,9 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { Topology, registerNode } from '@/components/common/@topology/core/index.js'
|
||||
// import { Topology, registerNode } from '@/components/common/@topology/core/index.js'
|
||||
import { Store as le5leStore } from 'le5le-store'
|
||||
// import { Topology, registerNode } from '@topology/core'
|
||||
import { Topology, registerNode } from '@topology/core'
|
||||
import imgDefault from '@/components/common/project/L5/services/img'
|
||||
import {
|
||||
Tools,
|
||||
|
||||
Reference in New Issue
Block a user