Browse Source

修复死循环问题

bill 3 years ago
parent
commit
30e7485e36
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/views/proportion/index.vue

+ 5 - 3
src/views/proportion/index.vue

@@ -18,7 +18,7 @@
 import { Message } from 'bill/index'
 import { useViewStack } from '@/hook'
 import { router } from '@/router'
-import { ref, computed, watchEffect } from 'vue'
+import { ref, computed, watchEffect, nextTick } from 'vue'
 import { getSceneModel } from '@/sdk'
 import { autoSaveFuseModels, getFuseModel, leave } from '@/store'
 
@@ -37,8 +37,10 @@ let scaleSet: ScaleSet | null = null
 const length = ref<number>()
 
 watchEffect(() => {
-  console.log('--setLength--')
-  length.value && scaleSet?.setLength(length.value)
+  const len = length.value
+  if (len) {
+    nextTick(() => scaleSet?.setLength(len))
+  }
 })
 
 const resetMeasure = () => {