Pārlūkot izejas kodu

一行谱增加销毁方法

黄琪勇 1 gadu atpakaļ
vecāks
revīzija
656e4dab8c

+ 6 - 1
src/page-instrument/view-detail/smoothAnimation/index.ts

@@ -49,7 +49,6 @@ export const smoothAnimationState = {
 watch(smoothAnimationState.isShow, () => {
    if (smoothAnimationState.isShow.value) {
       smoothAnimationState.smoothAnimationBoxDom?.classList.remove("smoothAnimationBoxHide")
-      //moveSmoothAnimation(moveState.progress, moveState.activeIndex)
    } else {
       smoothAnimationState.smoothAnimationBoxDom?.classList.add("smoothAnimationBoxHide")
    }
@@ -86,6 +85,7 @@ export function initSmoothAnimation() {
  * 销毁
  */
 export function destroySmoothAnimation() {
+   smoothAnimationState.isShow.value = false
    document.removeEventListener("resize", calcClientWidth)
    smoothAnimationState.smoothAnimationBoxDom?.remove()
    Object.assign(smoothAnimationState, {
@@ -102,6 +102,11 @@ export function destroySmoothAnimation() {
       aveSpeed: 0,
       clientWidth: 0
    })
+   Object.assign(moveState, {
+      oldIndex: -1,
+      progress: 0,
+      activeIndex: 0
+   })
 }
 
 /**