Ver código fonte

feat(marketingEdit): 优化画布切换逻辑

- 添加了旧索引保存以支持画布切换回退
- 实现了新的画布选择处理方法 handleSelectCanvas
- 通过 setTimeout 延时确保画布切换动画正确执行
- 修复了新增画布后索引更新的问题
- 优化了画布初始化和滚动逻辑
panqiuyao 1 dia atrás
pai
commit
5caf1510b5

+ 8 - 5
frontend/src/views/components/marketingEdit/index.vue

@@ -326,16 +326,19 @@ export default {
                multi_goods_mode: this.canvasForm.multi_goods_mode || '',
                max_goods_count: this.canvasForm.multi_goods_mode ? (this.canvasForm.max_goods_count || null) : null,
         })
+        const oldIndex = this.index
         const nextIndex = this.data.length - 1
-        this.$emit('update:index',nextIndex)
-        if(nextIndex === this.index){
+        this.handleSelectCanvas(nextIndex)
           this.$nextTick(() => {
             this.init()
             // 新增画布后也需要滚动
-            this.scrollToCanvas(nextIndex)
+            setTimeout(()=>{
+              this.handleSelectCanvas(oldIndex)
+            },100)
+            setTimeout(()=>{
+              this.handleSelectCanvas(nextIndex)
+            },200)
           })
-        }
-/*        this.index = this.data.length - 1*/
         this.canvasForm.visible = false;
       }else{