fix(仪表板): 内存泄漏
This commit is contained in:
parent
72c34aee6a
commit
18aa51ee10
@ -79,7 +79,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getStyle } from '@/components/canvas/utils/style'
|
import { getStyle } from '@/components/canvas/utils/style'
|
||||||
import runAnimation from '@/components/canvas/utils/runAnimation'
|
|
||||||
import { mixins } from '@/components/canvas/utils/events'
|
import { mixins } from '@/components/canvas/utils/events'
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import DeOutWidget from '@/components/dataease/DeOutWidget'
|
import DeOutWidget from '@/components/dataease/DeOutWidget'
|
||||||
@ -236,9 +235,6 @@ export default {
|
|||||||
'panelViewDetailsInfo'
|
'panelViewDetailsInfo'
|
||||||
])
|
])
|
||||||
},
|
},
|
||||||
mounted() {
|
|
||||||
runAnimation(this.$el, this.config.animations)
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
triggerFilterLoaded(p) {
|
triggerFilterLoaded(p) {
|
||||||
if (this.config.type === 'de-tabs') {
|
if (this.config.type === 'de-tabs') {
|
||||||
|
|||||||
@ -37,7 +37,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import eventBus from '@/components/canvas/utils/eventBus'
|
import eventBus from '@/components/canvas/utils/eventBus'
|
||||||
import runAnimation from '@/components/canvas/utils/runAnimation'
|
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import calculateComponentPositionAndSize from '@/components/canvas/utils/calculateComponentPositionAndSize'
|
import calculateComponentPositionAndSize from '@/components/canvas/utils/calculateComponentPositionAndSize'
|
||||||
import { mod360 } from '@/components/canvas/utils/translate'
|
import { mod360 } from '@/components/canvas/utils/translate'
|
||||||
@ -107,18 +106,8 @@ export default {
|
|||||||
this.cursors = this.getCursor() // 根据旋转角度获取光标位置
|
this.cursors = this.getCursor() // 根据旋转角度获取光标位置
|
||||||
}
|
}
|
||||||
this.element.type === 'custom' && (this.pointList = ['l', 'r'])
|
this.element.type === 'custom' && (this.pointList = ['l', 'r'])
|
||||||
|
|
||||||
eventBus.$on('runAnimation', this.runAnimation)
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
eventBus.$off('runAnimation', this.runAnimation)
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
runAnimation() {
|
|
||||||
if (this.element === this.curComponent) {
|
|
||||||
runAnimation(this.$el, this.curComponent.animations)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
// 鼠标移入事件
|
// 鼠标移入事件
|
||||||
enter() {
|
enter() {
|
||||||
this.mouseOn = true
|
this.mouseOn = true
|
||||||
|
|||||||
@ -106,6 +106,7 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
bus.$off('frameLinksChange-' + this.element.id, this.frameLinksChange)
|
bus.$off('frameLinksChange-' + this.element.id, this.frameLinksChange)
|
||||||
|
eventBus.$off('startMoveIn', this.frameLinksChange)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
frameLinksChange() {
|
frameLinksChange() {
|
||||||
|
|||||||
@ -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])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user