소스 검색

fix:预览自动播放功能完善

Grnetsky 1 년 전
부모
커밋
e0c41e4262
1개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 11 1
      src/views/components/PenAnimates.vue

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

@@ -226,13 +226,23 @@ const props = defineProps<{
 }>();
 function changeAnimateAutoPlay(value,item) {
   if(value){
-    if(props.pen.animations.length === 1)return
+    props.pen.autoPlay = true;
+    if(props.pen.animations.length === 1){
+      item.autoPlay = true
+      return
+    }
     props.pen.animations.forEach(i=>{
       if(i.name !== item.name){
         i.autoPlay = false
       }
     })
     item.autoPlay = true
+  }else {
+    let allFalse = props.pen.animations.every(i=>!i.autoPlay);
+    if(allFalse) {
+      props.pen.autoPlay = false
+      props.pen.frames = null
+    }
   }
 }
 const penTree: any = ref([]);