Просмотр исходного кода

fix(frontend): 修复 editor.vue :key 表达式违规(改用方法调用)

liaoxg 1 месяц назад
Родитель
Сommit
fe251bfc32
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      cfc-frontend/pages/orchestration/editor.vue

+ 4 - 1
cfc-frontend/pages/orchestration/editor.vue

@@ -28,7 +28,7 @@
         </view>
         </view>
 
 
         <!-- 节点列表 -->
         <!-- 节点列表 -->
-        <view v-for="(node, index) in nodes" :key="'node-' + index" class="node-item">
+        <view v-for="(node, index) in nodes" :key="getNodeKey(index)" class="node-item">
           <view class="node-header">
           <view class="node-header">
             <view class="node-order">
             <view class="node-order">
               <text class="order-num">{{ index + 1 }}</text>
               <text class="order-num">{{ index + 1 }}</text>
@@ -225,6 +225,9 @@ export default {
         this.templates = []
         this.templates = []
       }
       }
     },
     },
+    getNodeKey: function(index) {
+      return 'node-' + index
+    },
     getNodeTemplateName(node) {
     getNodeTemplateName(node) {
       if (!node.task_template_ref) return '未选择模板'
       if (!node.task_template_ref) return '未选择模板'
       var tpl = this.templates.find(function(t) { return t.id === Number(node.task_template_ref) })
       var tpl = this.templates.find(function(t) { return t.id === Number(node.task_template_ref) })