forked from github/dataease
fix: 内存泄露修复
This commit is contained in:
parent
2f76a9aece
commit
5716c4ad1f
@ -207,8 +207,10 @@ export default {
|
|||||||
mounted() {
|
mounted() {
|
||||||
this.preDraw()
|
this.preDraw()
|
||||||
},
|
},
|
||||||
destroyed() {
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.myChart.resize)
|
||||||
this.myChart.dispose()
|
this.myChart.dispose()
|
||||||
|
this.myChart = null
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.loadThemeStyle()
|
this.loadThemeStyle()
|
||||||
@ -403,9 +405,7 @@ export default {
|
|||||||
const chart = this.myChart
|
const chart = this.myChart
|
||||||
this.setBackGroundBorder()
|
this.setBackGroundBorder()
|
||||||
setTimeout(chart.setOption(option, true), 500)
|
setTimeout(chart.setOption(option, true), 500)
|
||||||
window.onresize = function() {
|
window.removeEventListener('resize', chart.resize)
|
||||||
chart.resize()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
setBackGroundBorder() {
|
setBackGroundBorder() {
|
||||||
if (this.chart.customStyle) {
|
if (this.chart.customStyle) {
|
||||||
|
@ -155,6 +155,11 @@ export default {
|
|||||||
this.drawEcharts()
|
this.drawEcharts()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.myChart.destroy()
|
||||||
|
window.removeEventListener('resize', this.calcHeightDelay)
|
||||||
|
this.myChart = null
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.preDraw()
|
this.preDraw()
|
||||||
},
|
},
|
||||||
@ -202,10 +207,7 @@ export default {
|
|||||||
new Promise((resolve) => { resolve() }).then(() => {
|
new Promise((resolve) => { resolve() }).then(() => {
|
||||||
this.drawView()
|
this.drawView()
|
||||||
})
|
})
|
||||||
const that = this
|
window.addEventListener('resize', this.calcHeightDelay)
|
||||||
window.onresize = function() {
|
|
||||||
that.calcHeightDelay()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
drawView() {
|
drawView() {
|
||||||
const chart = this.chart
|
const chart = this.chart
|
||||||
|
@ -195,6 +195,9 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
clearInterval(this.scrollTimer)
|
clearInterval(this.scrollTimer)
|
||||||
|
window.removeEventListener('resize', this.onResize)
|
||||||
|
this.myChart.destroy()
|
||||||
|
this.myChart = null
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
initData() {
|
initData() {
|
||||||
@ -221,21 +224,16 @@ export default {
|
|||||||
this.tableData = data
|
this.tableData = data
|
||||||
},
|
},
|
||||||
preDraw() {
|
preDraw() {
|
||||||
|
this.onResize()
|
||||||
|
window.addEventListener('resize', this.onResize)
|
||||||
|
},
|
||||||
|
onResize() {
|
||||||
this.initData()
|
this.initData()
|
||||||
this.initTitle()
|
this.initTitle()
|
||||||
this.calcHeightDelay()
|
this.calcHeightDelay()
|
||||||
new Promise((resolve) => { resolve() }).then(() => {
|
new Promise((resolve) => { resolve() }).then(() => {
|
||||||
this.drawView()
|
this.drawView()
|
||||||
})
|
})
|
||||||
const that = this
|
|
||||||
window.onresize = function() {
|
|
||||||
that.initData()
|
|
||||||
that.initTitle()
|
|
||||||
that.calcHeightDelay()
|
|
||||||
new Promise((resolve) => { resolve() }).then(() => {
|
|
||||||
that.drawView()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
drawView() {
|
drawView() {
|
||||||
const chart = this.chart
|
const chart = this.chart
|
||||||
|
@ -133,15 +133,13 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
eventBus.$off('resizing', this.chartResize)
|
eventBus.$off('resizing', this.chartResize)
|
||||||
|
window.removeEventListener('resize', this.calcHeight)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
const that = this
|
|
||||||
this.initStyle()
|
this.initStyle()
|
||||||
this.resultFormat()
|
this.resultFormat()
|
||||||
window.onresize = function() {
|
window.addEventListener('resize', this.calcHeight)
|
||||||
that.calcHeight()
|
|
||||||
}
|
|
||||||
this.setBackGroundBorder()
|
this.setBackGroundBorder()
|
||||||
this.initRemark()
|
this.initRemark()
|
||||||
},
|
},
|
||||||
|
@ -161,14 +161,12 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
eventBus.$off('resizing', this.chartResize)
|
eventBus.$off('resizing', this.chartResize)
|
||||||
|
window.removeEventListener('resize', this.calcHeight)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
const that = this
|
|
||||||
this.initStyle()
|
this.initStyle()
|
||||||
window.onresize = function() {
|
window.addEventListener('resize', this.calcHeight)
|
||||||
that.calcHeight()
|
|
||||||
}
|
|
||||||
this.setBackGroundBorder()
|
this.setBackGroundBorder()
|
||||||
this.initRemark()
|
this.initRemark()
|
||||||
},
|
},
|
||||||
|
@ -168,6 +168,7 @@ export default {
|
|||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
eventBus.$off('resizing', this.chartResize)
|
eventBus.$off('resizing', this.chartResize)
|
||||||
clearInterval(this.scrollTimer)
|
clearInterval(this.scrollTimer)
|
||||||
|
window.removeEventListener('resize', this.calcHeightDelay)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
@ -187,7 +188,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
initData() {
|
initData() {
|
||||||
const that = this
|
|
||||||
let data = []
|
let data = []
|
||||||
this.showPage = false
|
this.showPage = false
|
||||||
if (this.chart.data) {
|
if (this.chart.data) {
|
||||||
@ -229,9 +229,7 @@ export default {
|
|||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.initStyle()
|
this.initStyle()
|
||||||
})
|
})
|
||||||
window.onresize = function() {
|
window.addEventListener('resize', this.calcHeightDelay)
|
||||||
that.calcHeightDelay()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
calcHeightRightNow() {
|
calcHeightRightNow() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
|
@ -568,10 +568,11 @@ export default {
|
|||||||
this.filterField(val)
|
this.filterField(val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calcHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calcHeight)
|
||||||
this.calcHeight()
|
|
||||||
}
|
|
||||||
this.calcHeight()
|
this.calcHeight()
|
||||||
this.initField()
|
this.initField()
|
||||||
},
|
},
|
||||||
|
@ -312,11 +312,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDataSource()
|
this.initDataSource()
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
@ -140,10 +140,11 @@ export default {
|
|||||||
this.getUnionData()
|
this.getUnionData()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
|
|
||||||
if (this.param && this.param.id && this.param.tableId) {
|
if (this.param && this.param.id && this.param.tableId) {
|
||||||
|
@ -328,11 +328,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initDataSource()
|
this.initDataSource()
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
@ -304,10 +304,11 @@ export default {
|
|||||||
return this.nameList.filter((ele) => ele !== this.originName)
|
return this.nameList.filter((ele) => ele !== this.originName)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
@ -675,10 +675,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
await this.initDataSource()
|
await this.initDataSource()
|
||||||
this.$refs.myCm.codemirror.on('keypress', () => {
|
this.$refs.myCm.codemirror.on('keypress', () => {
|
||||||
|
@ -57,12 +57,13 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.initPreview()
|
this.initPreview()
|
||||||
this.calHeight()
|
this.calHeight()
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calHeight)
|
||||||
this.calHeight()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
calHeight: _.debounce(function() {
|
calHeight: _.debounce(function() {
|
||||||
|
@ -80,12 +80,6 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
// window.onresize = () => {
|
|
||||||
// return (() => {
|
|
||||||
// this.height = window.innerHeight / 3
|
|
||||||
// })()
|
|
||||||
// }
|
|
||||||
// this.height = window.innerHeight / 3
|
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
this.height =
|
this.height =
|
||||||
document.getElementById('dsData').parentNode.offsetHeight - 16 - 14 - 5
|
document.getElementById('dsData').parentNode.offsetHeight - 16 - 14 - 5
|
||||||
|
@ -794,10 +794,11 @@ export default {
|
|||||||
this.filterField(val)
|
this.filterField(val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
window.removeEventListener('resize', this.calcHeight)
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
window.onresize = () => {
|
window.addEventListener('resize', this.calcHeight)
|
||||||
this.calcHeight()
|
|
||||||
}
|
|
||||||
this.calcHeight()
|
this.calcHeight()
|
||||||
this.initField()
|
this.initField()
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user