فهرست منبع

fix(miniapp): 修复 ContentSharePoster 分享海报 String 属性收到 null 告警

三个调用方(商品详情/文章详情/活动详情)把可能为 null 的值直接绑定到
ContentSharePoster 的 String props(title/coverImage/summary/priceText 等)。
Vue 2 中 props 的 default 只在未传时生效,显式绑定 null 会触发微信类型检查
告警 [Component] property received type-uncompatible value: expected <String>
but get null value。已在所有绑定处加 || '' 兜底。

Reviewed-by: Sisyphus
asus 2 ماه پیش
والد
کامیت
ad67c08460

+ 7 - 7
cfc-frontend/pages/activity/activity-detail/activity-detail.vue

@@ -253,14 +253,14 @@
     <!-- 分享海报 -->
     <ContentSharePoster
       :show="showPoster"
-      :title="activity && activity.title"
-      :coverImage="activity && getImageUrl(activity.coverImage)"
-      :qrCodeBase64="posterQrCode"
+      :title="(activity && activity.title) || ''"
+      :coverImage="(activity && getImageUrl(activity.coverImage)) || ''"
+      :qrCodeBase64="posterQrCode || ''"
       typeLabel="活动推荐"
-      :dimensionCode="activity && activity.dimensionCode"
-      :summary="posterSummary"
-      :priceText="posterPriceText"
-      :inviteText="posterInviteText"
+      :dimensionCode="(activity && activity.dimensionCode) || ''"
+      :summary="posterSummary || ''"
+      :priceText="posterPriceText || ''"
+      :inviteText="posterInviteText || ''"
       @close="closePoster"
     />
   </view>

+ 1 - 1
cfc-frontend/pages/article-center/article-detail.vue

@@ -46,7 +46,7 @@
       </view>
     </template>
 
-    <ContentSharePoster :show="showPoster" :title="article && article.title" :coverImage="article && article.coverImage" :qrCodeBase64="posterQrCode" typeLabel="好文推荐" :dimensionCode="posterDimension" :summary="posterSummary" :inviteText="posterInviteText" @close="closePoster" />
+    <ContentSharePoster :show="showPoster" :title="(article && article.title) || ''" :coverImage="(article && article.coverImage) || ''" :qrCodeBase64="posterQrCode || ''" typeLabel="好文推荐" :dimensionCode="posterDimension || ''" :summary="posterSummary || ''" :inviteText="posterInviteText || ''" @close="closePoster" />
 
     <!-- 浠宝答题弹窗 -->
     <view class="quiz-mask" v-if="showQuiz" @click="closeQuiz">

+ 1 - 1
cfc-frontend/pages/discover-detail/product-detail/product-detail.vue

@@ -117,7 +117,7 @@
       </view>
     </view>
 
-    <ContentSharePoster :show="showPoster" :title="product.name" :coverImage="getImageUrl(product.coverImage)" :qrCodeBase64="posterQrCode" typeLabel="好物推荐" :dimensionCode="posterDimension" :priceText="priceText" :summary="product.intro" ctaText="长按识别二维码 · 查看商品" :inviteText="posterInviteText" @close="showPoster = false" />
+    <ContentSharePoster :show="showPoster" :title="product.name || ''" :coverImage="getImageUrl(product.coverImage) || ''" :qrCodeBase64="posterQrCode || ''" typeLabel="好物推荐" :dimensionCode="posterDimension || ''" :priceText="priceText || ''" :summary="product.intro || ''" ctaText="长按识别二维码 · 查看商品" :inviteText="posterInviteText || ''" @close="showPoster = false" />
   </view>
 </template>