ソースを参照

fix: 修复6处:key表达式警告

liaoxg 2 ヶ月 前
親
コミット
3198faf627

+ 2 - 2
cfc-frontend/pages/health/health-plan-summary.vue

@@ -97,8 +97,8 @@
             <text class="task-exec-label">执行人</text>
             <view class="exec-row">
               <view
-                v-for="m in executors"
-                :key="m.memberId"
+                v-for="(m, mIdx) in executors"
+                :key="getMemberKey(m, mIdx)"
                 class="exec-chip"
                 :class="{ active: task.executorId === m.memberId }"
                 @click="task.executorId = m.memberId"

+ 2 - 1
cfc-frontend/pages/problem/package-detail.vue

@@ -22,7 +22,7 @@
 
       <view class="pd-section" v-if="includedItems && includedItems.length > 0">
         <text class="pd-section-title">包含项目</text>
-        <view class="pd-item" v-for="(item, i) in includedItems" :key="'i' + i">
+        <view class="pd-item" v-for="(item, i) in includedItems" :key="getIncKey(i)">
           <text class="pd-item-icon">•</text>
           <text class="pd-item-text">{{ item }}</text>
         </view>
@@ -67,6 +67,7 @@ export default {
     this.loadDetail()
   },
   methods: {
+    getIncKey: function(i) { return 'i' + i },
     loadDetail() {
       var self = this
       self.loading = true

+ 2 - 1
cfc-frontend/pages/problem/package-match.vue

@@ -19,7 +19,7 @@
           <text class="pm-card-meta-text">有效期:{{ p.validityDays }}天</text>
         </view>
         <view class="pm-card-badges" v-if="p.badges && p.badges.length > 0">
-          <text class="pm-badge" v-for="(b, i) in p.badges" :key="'b' + i">{{ b }}</text>
+          <text class="pm-badge" v-for="(b, i) in p.badges" :key="getBadgeKey(i)">{{ b }}</text>
         </view>
         <view class="pm-card-btn" @click="goDetail(p)">
           <text class="pm-card-btn-text">查看套餐详情</text>
@@ -45,6 +45,7 @@ export default {
     this.loadPackages()
   },
   methods: {
+    getBadgeKey: function(i) { return 'b' + i },
     getKey(p) {
       return p.id || p.code || Math.random()
     },

+ 2 - 1
cfc-frontend/pages/problem/plan-confirm.vue

@@ -24,7 +24,7 @@
 
       <view class="pc-report-section" v-if="planItems && planItems.length > 0">
         <text class="pc-section-title">建议方案</text>
-        <view class="pc-plan-item" v-for="(item, i) in planItems" :key="'p' + i">
+        <view class="pc-plan-item" v-for="(item, i) in planItems" :key="getPlanKey(i)">
           <text class="pc-plan-num">{{ i + 1 }}</text>
           <view class="pc-plan-body">
             <text class="pc-plan-title">{{ item.title }}</text>
@@ -59,6 +59,7 @@ export default {
     this.loadPlan()
   },
   methods: {
+    getPlanKey: function(i) { return 'p' + i },
     loadPlan() {
       var self = this
       self.loading = true

+ 4 - 2
cfc-frontend/pages/problem/survey.vue

@@ -9,13 +9,13 @@
     <view class="sv-empty" v-else-if="!questions || questions.length === 0">暂无问卷题目</view>
 
     <view class="sv-form" v-else>
-      <view class="sv-q" v-for="(q, qi) in questions" :key="'q' + qi">
+      <view class="sv-q" v-for="(q, qi) in questions" :key="getQKey(qi)">
         <text class="sv-q-label">{{ qi + 1 }}. {{ q.text }}</text>
         <view class="sv-options">
           <view
             class="sv-opt"
             v-for="(o, oi) in q.options"
-            :key="'o' + qi + '_' + oi"
+            :key="getOptKey(qi, oi)"
             :class="{ 'sv-opt-active': isSelected(qi, oi) }"
             @click="toggleOpt(qi, oi, q)">
             <text class="sv-opt-text">{{ o.text }}</text>
@@ -51,6 +51,8 @@ export default {
     this.loadQuestions()
   },
   methods: {
+    getQKey: function(qi) { return 'q' + qi },
+    getOptKey: function(qi, oi) { return 'o' + qi + '_' + oi },
     isSelected(qi, oi) {
       var ans = this.answers[qi]
       return ans && ans.indexOf(oi) !== -1