fix(仪表板): 内存泄漏

This commit is contained in:
dataeaseShu 2024-03-01 18:11:33 +08:00
parent 72c34aee6a
commit 18aa51ee10
4 changed files with 1 additions and 33 deletions

View File

@ -79,7 +79,6 @@
<script>
import { getStyle } from '@/components/canvas/utils/style'
import runAnimation from '@/components/canvas/utils/runAnimation'
import { mixins } from '@/components/canvas/utils/events'
import { mapState } from 'vuex'
import DeOutWidget from '@/components/dataease/DeOutWidget'
@ -236,9 +235,6 @@ export default {
'panelViewDetailsInfo'
])
},
mounted() {
runAnimation(this.$el, this.config.animations)
},
methods: {
triggerFilterLoaded(p) {
if (this.config.type === 'de-tabs') {

View File

@ -37,7 +37,6 @@
<script>
import eventBus from '@/components/canvas/utils/eventBus'
import runAnimation from '@/components/canvas/utils/runAnimation'
import { mapState } from 'vuex'
import calculateComponentPositionAndSize from '@/components/canvas/utils/calculateComponentPositionAndSize'
import { mod360 } from '@/components/canvas/utils/translate'
@ -107,18 +106,8 @@ export default {
this.cursors = this.getCursor() //
}
this.element.type === 'custom' && (this.pointList = ['l', 'r'])
eventBus.$on('runAnimation', this.runAnimation)
},
beforeDestroy() {
eventBus.$off('runAnimation', this.runAnimation)
},
methods: {
runAnimation() {
if (this.element === this.curComponent) {
runAnimation(this.$el, this.curComponent.animations)
}
},
//
enter() {
this.mouseOn = true

View File

@ -106,6 +106,7 @@ export default {
},
beforeDestroy() {
bus.$off('frameLinksChange-' + this.element.id, this.frameLinksChange)
eventBus.$off('startMoveIn', this.frameLinksChange)
},
methods: {
frameLinksChange() {

View File

@ -1,18 +0,0 @@
export default async function runAnimation($el, animations = []) {
const play = (animation) => new Promise(resolve => {
$el.classList.add(animation.value, 'animated')
const removeAnimation = () => {
$el.removeEventListener('animationend', removeAnimation)
$el.removeEventListener('animationcancel', removeAnimation)
$el.classList.remove(animation.value, 'animated')
resolve()
}
$el.addEventListener('animationend', removeAnimation)
$el.addEventListener('animationcancel', removeAnimation)
})
for (let i = 0, len = animations.length; i < len; i++) {
await play(animations[i])
}
}