Browse Source

fix(marketingEdit): 修复新增画布后的索引更新问题

- 将 handleSelectCanvas 调用替换为 emit update:index 事件
- 调整 init() 调用时机至所有索引更新完成后
- 优化 setTimeout 延迟时间以确保正确的执行顺序
- 解决画布切换和初始化的时序问题
panqiuyao 6 ngày trước cách đây
mục cha
commit
c322c7b187
1 tập tin đã thay đổi với 7 bổ sung6 xóa
  1. 7 6
      frontend/src/views/components/marketingEdit/index.vue

+ 7 - 6
frontend/src/views/components/marketingEdit/index.vue

@@ -586,16 +586,17 @@ export default {
         })
         const oldIndex = this.index
         const nextIndex = this.data.length - 1
-        this.handleSelectCanvas(nextIndex)
+        this.$emit('update:index',nextIndex)
           this.$nextTick(() => {
-            this.init()
             // 新增画布后也需要滚动
             setTimeout(()=>{
-              this.handleSelectCanvas(oldIndex)
-            },100)
+              this.$emit('update:index',oldIndex)
+            },10)
             setTimeout(()=>{
-              this.handleSelectCanvas(nextIndex)
-            },200)
+              this.$emit('update:index',nextIndex)
+            },300)
+
+            this.init()
           })
         this.canvasForm.visible = false;
       }else{