Bladeren bron

perf: 优化加载进度条体验

奔跑的面条 2 jaren geleden
bovenliggende
commit
2ec7386931
2 gewijzigde bestanden met toevoegingen van 7 en 1 verwijderingen
  1. 7 0
      src/views/chart/ContentLoad/index.vue
  2. 0 1
      src/views/chart/hooks/useSync.hook.ts

+ 7 - 0
src/views/chart/ContentLoad/index.vue

@@ -26,6 +26,13 @@ const themeColor = computed(() => {
 watch(
   () => chartLayoutStore.getPercentage,
   newValue => {
+    if (newValue === 0) {
+      setTimeout(() => {
+        percentage.value = newValue
+        showModal.value = false
+      }, 500);
+      return
+    }
     percentage.value = newValue
     showModal.value = newValue > 0
   }

+ 0 - 1
src/views/chart/hooks/useSync.hook.ts

@@ -155,7 +155,6 @@ export const useSync = () => {
       if (key === ChartEditStoreEnum.COMPONENT_LIST) {
         let loadIndex = 0
         const listLength = projectData[key].length;
-        console.log(listLength)
         for (const comItem of projectData[key]) {
           // 设置加载数量
           let percentage = parseInt((parseFloat(`${++loadIndex / listLength}`) * 100).toString())