mo 1 jaar geleden
bovenliggende
commit
fd71e8374f
2 gewijzigde bestanden met toevoegingen van 27 en 22 verwijderingen
  1. 24 19
      src/components/timerMeter/components/countdown.tsx
  2. 3 3
      src/components/timerMeter/modals/flipper.vue

+ 24 - 19
src/components/timerMeter/components/countdown.tsx

@@ -149,24 +149,23 @@ export default defineComponent({
     })
    const addSecondTimer = (num:number)=>{
 
-    nextTick(()=>{
-      const lastStr = getSecond(count.value)
-      count.value+=num
-      count.value >3599?count.value = 3599: count.value
-      const str = getSecond(count.value)
-      for (let i = 0; i < flipObjs.value.length; i++) {
-        if (lastStr[i] === str[i]) {
-          continue
-        }
-        flipObjs.value[i].value.flipDown(lastStr[i], str[i])
+
+    const lastStr = getSecond(count.value)
+    count.value+=num
+    count.value >3599?count.value = 3599: count.value
+    const str = getSecond(count.value)
+    for (let i = 0; i < flipObjs.value.length; i++) {
+      if (lastStr[i] === str[i]) {
+        continue
       }
-      mine.value = Math.floor(count.value / 60)
-      second.value = Math.floor(count.value % 60)
-    })
+      flipObjs.value[i].value.flipDown(lastStr[i], str[i])
+    }
+    mine.value = Math.floor(count.value / 60)
+    second.value = Math.floor(count.value % 60)
 
    }
   const minusSecondTimer = (num:number)=>{
-    nextTick(()=>{
+
       const lastStr = getSecond(count.value)
       count.value -=num
       count.value <0?count.value = 0: count.value
@@ -179,12 +178,15 @@ export default defineComponent({
       }
        mine.value = Math.floor(count.value / 60)
       second.value = Math.floor(count.value % 60)
-    })
+
+
+
 
   }
 
   const updateMin = ()=>{
-    nextTick(()=>{
+
+    setTimeout(()=>{
       console.log(mine.value, count.value)
       const lastStr = getSecond(count.value)
       count.value = mine.value*60+second.value
@@ -196,12 +198,13 @@ export default defineComponent({
         }
         flipObjs.value[i].value.flipUp(lastStr[i], str[i])
       }
-    })
+    },600)
+
 
 
   }
   const updateSecond=()=>{
-    nextTick(()=>{
+    setTimeout(()=>{
       console.log(mine.value)
       const lastStr = getSecond( count.value)
       count.value = mine.value*60+second.value
@@ -212,7 +215,9 @@ export default defineComponent({
         }
         flipObjs.value[i].value.flipUp(lastStr[i], str[i])
       }
-    })
+    },600)
+
+
   }
 
   watch(()=> count.value,(val)=>{

+ 3 - 3
src/components/timerMeter/modals/flipper.vue

@@ -43,9 +43,9 @@ export default {
     },
     _flip(type, front, back) {
       // 如果处于翻转中,则不执行
-      if (this.isFlipping) {
-        return false
-      }
+      // if (this.isFlipping) {
+      //   return false
+      // }
       this.frontTextFromData = front
       this.backTextFromData = back
       // 根据传递过来的type设置翻转方向