Kaynağa Gözat

fix(frontend): 修复 2 处 :key 字符串拼接表达式告警

- components/ContentSharePoster.vue
  - ':key="tpl_' + tpl.id"' -> getTplKey(tpl)
  - ':key="bg_' + i"' -> getBgKey(i)
- pages/health/report-list.vue
  - ':key="item.reportType + '-' + item.id"' -> getReportKey(item)
liaoxg 1 hafta önce
ebeveyn
işleme
d76965e706

+ 8 - 2
cfc-frontend/components/ContentSharePoster.vue

@@ -8,7 +8,7 @@
         <view class="tpl-options">
           <view
             v-for="tpl in serverTemplates"
-            :key="'tpl_' + tpl.id"
+            :key="getTplKey(tpl)"
             class="tpl-option"
             :class="{ 'tpl-active': activeTemplateId === tpl.id }"
             @click="switchTemplate(tpl)"
@@ -24,7 +24,7 @@
         <view class="bg-options">
           <view
             v-for="(c, i) in bgOptions"
-            :key="'bg_' + i"
+            :key="getBgKey(i)"
             class="bg-option"
             :class="{ 'bg-active': bgColor === c }"
             :style="{ background: c }"
@@ -134,6 +134,12 @@ export default {
     }
   },
   methods: {
+    getTplKey(tpl) {
+      return 'tpl_' + tpl.id
+    },
+    getBgKey(i) {
+      return 'bg_' + i
+    },
     // 海报画布文字按用户字号系数放大(画布有固定排版,放大区间比页面更保守,防止溢出裁切)
     _fs(size) {
       var scale = getFontScale()

+ 4 - 1
cfc-frontend/pages/health/report-list.vue

@@ -66,7 +66,7 @@
 
     <!-- 报告列表 -->
     <view class="report-list" v-else-if="reports.length > 0">
-      <view class="swipe-row" v-for="item in reports" :key="item.reportType + '-' + item.id">
+      <view class="swipe-row" v-for="item in reports" :key="getReportKey(item)">
         <!-- 右侧操作按钮(左滑后露出:删除 + 调整归属);DAN 报告不可左右滑动删除 -->
         <view class="swipe-actions" v-if="item.reportType !== 'dan'">
           <view class="swipe-delete" @click.stop="confirmDelete(item)">删除</view>
@@ -231,6 +231,9 @@ export default {
     }
   },
   methods: {
+    getReportKey(item) {
+      return item.reportType + '-' + item.id
+    },
     adjustBinding(item) {
       var self = this
       // 显示成员选择面板