fix:清除拓扑绑定事件
This commit is contained in:
@@ -108,7 +108,7 @@ export default {
|
|||||||
},
|
},
|
||||||
drawBubbleChart () {
|
drawBubbleChart () {
|
||||||
this.$nextTick(() => {
|
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}`)
|
const svg = document.getElementById(`bubble-svg-${this.chartId}`)
|
||||||
if (!svg) {
|
if (!svg) {
|
||||||
return false
|
return false
|
||||||
@@ -282,6 +282,9 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.colorList = initColor(20)
|
this.colorList = initColor(20)
|
||||||
this.chartInfo.loaded && this.initChart()
|
this.chartInfo.loaded && this.initChart()
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
d3.select(`#bubble-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ export default {
|
|||||||
funnelData = funnelData.filter(item => item.value !== 0)
|
funnelData = funnelData.filter(item => item.value !== 0)
|
||||||
}
|
}
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove()// 清空作图区域
|
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
// 获取svg宽高 初始化画布
|
// 获取svg宽高 初始化画布
|
||||||
const svgDom = document.getElementById(`funnel-svg-${this.chartId}`)
|
const svgDom = document.getElementById(`funnel-svg-${this.chartId}`)
|
||||||
if (!svgDom) {
|
if (!svgDom) {
|
||||||
@@ -372,6 +372,9 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.colorList = initColor(20)
|
this.colorList = initColor(20)
|
||||||
this.chartInfo.loaded && this.initChart(true)
|
this.chartInfo.loaded && this.initChart(true)
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
d3.select(`#funnel-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default {
|
|||||||
|
|
||||||
drawRankChart () {
|
drawRankChart () {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove()// 清空作图区域
|
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
// 获取svg宽高 初始化画布
|
// 获取svg宽高 初始化画布
|
||||||
const svgDom = document.getElementById(`rank-svg-${this.chartId}`)
|
const svgDom = document.getElementById(`rank-svg-${this.chartId}`)
|
||||||
if (!svgDom) {
|
if (!svgDom) {
|
||||||
@@ -294,6 +294,9 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.colorList = initColor(20)
|
this.colorList = initColor(20)
|
||||||
this.chartInfo.loaded && this.initChart()
|
this.chartInfo.loaded && this.initChart()
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
d3.select(`#rank-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -136,8 +136,7 @@ export default {
|
|||||||
|
|
||||||
drawSankeyChart () {
|
drawSankeyChart () {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
// 清空作图区域
|
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove()
|
|
||||||
|
|
||||||
// 获取svg宽高 初始化画布
|
// 获取svg宽高 初始化画布
|
||||||
const svgDom = document.getElementById(`sankey-svg-${this.chartId}`)
|
const svgDom = document.getElementById(`sankey-svg-${this.chartId}`)
|
||||||
@@ -395,6 +394,9 @@ export default {
|
|||||||
mounted () {
|
mounted () {
|
||||||
this.colorList = initColor(20)
|
this.colorList = initColor(20)
|
||||||
this.chartInfo.loaded && this.initChart()
|
this.chartInfo.loaded && this.initChart()
|
||||||
|
},
|
||||||
|
beforeDestroy () {
|
||||||
|
d3.select(`#sankey-svg-${this.chartId}`).selectAll('g').remove() // 清空作图区域
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -190,12 +190,22 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
if (getTopology(this.meta2dId)) {
|
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)
|
setTopology(this.meta2dId, null)
|
||||||
}
|
}
|
||||||
bus.$off('changeSelectPens', this.pensActive)
|
bus.$off('changeSelectPens', this.pensActive)
|
||||||
this.$refs.meta2dBox.removeEventListener('mousemove', this.mousemove)
|
this.$refs.meta2dBox.removeEventListener('mousemove', this.mousemove)
|
||||||
this.$refs.meta2dBox.removeEventListener('mouseup', this.mouseup)
|
this.$refs.meta2dBox.removeEventListener('mouseup', this.mouseup)
|
||||||
|
window.removeEventListener('click', this.contextmenuNone)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user