fix:清除拓扑绑定事件
This commit is contained in:
@@ -108,7 +108,7 @@ export default {
|
||||
},
|
||||
drawBubbleChart () {
|
||||
this.$nextTick(() => {
|
||||
d3.select(`#bubble-svg-${this.chartId}`).selectAll('g').remove()// 清空作图区域
|
||||
d3.select(`#bubble-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
const svg = document.getElementById(`bubble-svg-${this.chartId}`)
|
||||
if (!svg) {
|
||||
return false
|
||||
@@ -282,6 +282,9 @@ export default {
|
||||
mounted () {
|
||||
this.colorList = initColor(20)
|
||||
this.chartInfo.loaded && this.initChart()
|
||||
},
|
||||
beforeDestroy () {
|
||||
d3.select(`#bubble-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -122,7 +122,7 @@ export default {
|
||||
funnelData = funnelData.filter(item => item.value !== 0)
|
||||
}
|
||||
this.$nextTick(() => {
|
||||
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove()// 清空作图区域
|
||||
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
// 获取svg宽高 初始化画布
|
||||
const svgDom = document.getElementById(`funnel-svg-${this.chartId}`)
|
||||
if (!svgDom) {
|
||||
@@ -372,6 +372,9 @@ export default {
|
||||
mounted () {
|
||||
this.colorList = initColor(20)
|
||||
this.chartInfo.loaded && this.initChart(true)
|
||||
},
|
||||
beforeDestroy () {
|
||||
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -115,7 +115,7 @@ export default {
|
||||
|
||||
drawRankChart () {
|
||||
this.$nextTick(() => {
|
||||
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove()// 清空作图区域
|
||||
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
// 获取svg宽高 初始化画布
|
||||
const svgDom = document.getElementById(`rank-svg-${this.chartId}`)
|
||||
if (!svgDom) {
|
||||
@@ -294,6 +294,9 @@ export default {
|
||||
mounted () {
|
||||
this.colorList = initColor(20)
|
||||
this.chartInfo.loaded && this.initChart()
|
||||
},
|
||||
beforeDestroy () {
|
||||
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -136,8 +136,7 @@ export default {
|
||||
|
||||
drawSankeyChart () {
|
||||
this.$nextTick(() => {
|
||||
// 清空作图区域
|
||||
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove()
|
||||
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
|
||||
// 获取svg宽高 初始化画布
|
||||
const svgDom = document.getElementById(`sankey-svg-${this.chartId}`)
|
||||
@@ -395,6 +394,9 @@ export default {
|
||||
mounted () {
|
||||
this.colorList = initColor(20)
|
||||
this.chartInfo.loaded && this.initChart()
|
||||
},
|
||||
beforeDestroy () {
|
||||
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -190,12 +190,22 @@ export default {
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (getTopology(this.meta2dId)) {
|
||||
getTopology(this.meta2dId).clear()
|
||||
getTopology(this.meta2dId).off('translate', this.topTranslate) // 平移·
|
||||
getTopology(this.meta2dId).off('scale', this.topoScale) // 缩放·
|
||||
getTopology(this.meta2dId).off('active', this.pensActive) // 选中·
|
||||
getTopology(this.meta2dId).off('translatePens', () => {}) // 移动画笔结束·
|
||||
getTopology(this.meta2dId).off('translatingPens', () => {}) // 移动画笔进行中·
|
||||
getTopology(this.meta2dId).off('enter', this.penEnter) // 移入画笔·
|
||||
getTopology(this.meta2dId).off('leave', this.penLeave) // 移出画笔·
|
||||
getTopology(this.meta2dId).off('add', this.appPen) // 添加新画笔·
|
||||
getTopology(this.meta2dId).off('click', this.topoClick) // click画笔·
|
||||
getTopology(this.meta2dId).destroy()
|
||||
setTopology(this.meta2dId, null)
|
||||
}
|
||||
bus.$off('changeSelectPens', this.pensActive)
|
||||
this.$refs.meta2dBox.removeEventListener('mousemove', this.mousemove)
|
||||
this.$refs.meta2dBox.removeEventListener('mouseup', this.mouseup)
|
||||
window.removeEventListener('click', this.contextmenuNone)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user