Pārlūkot izejas kodu

fix(mind): replace template literal fallback with computed props for WXML compat

WXML 不支持模板中 || {} 和 || '' 字面量编译
新增 dailyFortuneSafe / dominantElementSafe computed 属性做 fallback

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg 1 mēnesi atpakaļ
vecāks
revīzija
8ea2c628e8
1 mainītis faili ar 10 papildinājumiem un 2 dzēšanām
  1. 10 2
      cfc-frontend/pages/mind/index.vue

+ 10 - 2
cfc-frontend/pages/mind/index.vue

@@ -12,9 +12,9 @@
     <FamilyTianpanCard
       v-if="isLoggedIn"
       :visible="isLoggedIn"
-      :fortune="dailyFortune || {}"
+      :fortune="dailyFortuneSafe"
       :mood="todayMood"
-      :dominantElement="dominantElement || ''"
+      :dominantElement="dominantElementSafe"
       :weeklyTip="familyWeeklyInsight"
       :traditionalData="traditionalData" />
 
@@ -378,6 +378,14 @@ export default {
       }
       return '0'
     },
+    // WXML 不支持模板内 || {} 字面量,需在 computed 中预先做 fallback
+    dailyFortuneSafe: function() {
+      return this.dailyFortune || {}
+    },
+    // WXML 不支持模板内 || '' 字面量,需在 computed 中预先做 fallback
+    dominantElementSafe: function() {
+      return this.dominantElement || ''
+    },
     dailyFortune: function() {
         // 优先使用后端接口数据
         if (this.dailyFortuneData) {