Explorar o código

fix:delAnimate

ananzhusen hai 1 ano
pai
achega
f6327ac707
Modificáronse 1 ficheiros con 11 adicións e 5 borrados
  1. 11 5
      src/views/components/PenAnimates.vue

+ 11 - 5
src/views/components/PenAnimates.vue

@@ -18,7 +18,7 @@
               />
               <t-icon
                 v-if="isPlaying === i"
-                name="stop-circle-1"
+                name="stop-circle"
                 class="hover primary"
                 style="font-size: 16px"
                 @click="stop"
@@ -44,10 +44,7 @@
               <t-popconfirm
                 content="确认删除该动画吗"
                 placement="left"
-                @confirm="
-                  props.pen.animations.splice(i, 1);
-                  animate = undefined;
-                "
+                @confirm="delAnimate(i)"
               >
                 <t-icon name="delete" class="hover" />
               </t-popconfirm>
@@ -435,6 +432,15 @@ const addAnimate = () => {
   });
 };
 
+const delAnimate = (i: number) => {
+  if (isPlaying.value === i) {
+    meta2d.stopAnimate(props.pen.id);
+    isPlaying.value = undefined;
+  }
+  props.pen.animations.splice(i, 1);
+  animate.value = undefined;
+};
+
 const changeAnimate = (item: any) => {
   const animate: any = animateList.find((elem: any) => {
     return elem.value === item.animate;