Sfoglia il codice sorgente

优惠活动内容效验

Xiao_123 1 mese fa
parent
commit
1510437e25
1 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 8 1
      src/views/mall/components/details.vue

+ 8 - 1
src/views/mall/components/details.vue

@@ -38,7 +38,8 @@
               <div class="price mr-5"><span>¥</span>{{ selectedSkuPrice}}</div>
               <div class="marketPrice" v-if="selectedSkuMarketPrice && selectedSkuMarketPrice !== selectedSkuPrice">优惠前¥{{ selectedSkuMarketPrice}}</div>
             </div>
-            <div v-if="state.goodsInfo?.activeIntroduction" class="activePrices right pa-3 mt-3" v-html="state.goodsInfo?.activeIntroduction"></div>
+            <!-- 优惠说明 -->
+            <div v-if="checkContent(state.goodsInfo?.activeIntroduction)" class="activePrices right pa-3 mt-3" v-html="state.goodsInfo?.activeIntroduction"></div>
           </div>
           <!-- 销量 -->
           <div class="salesCount mb-5 parameterColor"><span class="l-s-10">已售</span>:{{ state.goodsInfo?.salesCount || 0 }}</div>
@@ -149,6 +150,12 @@ const state = reactive({
   activityList: [], // 【秒杀/拼团/砍价】可参与的 Activity 营销活动的列表
 });
 
+const checkContent = (content) => {
+  if (!content) return false
+  const text = content.replace(/<[^>]*>/g, '').trim();
+  return text.length > 0
+}
+
 // 规格变更
 function onSkuChange(e) {
   state.selectedSku = e;