From 35e1750a968983c00c0c7b81a7000817c5ef1d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=93=E5=B9=B3=E8=89=BA?= <52643018@qq.com> Date: Tue, 29 Jun 2021 15:14:36 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BC=98=E5=8C=96]=20=E5=A4=84=E7=90=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85=E9=A1=B5=E5=AF=8C=E6=96=87?= =?UTF-8?q?=E6=9C=AC=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 6 ++++-- pages/goodsDetail/index.vue | 28 ++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/manifest.json b/manifest.json index 08feb0f..540de4d 100644 --- a/manifest.json +++ b/manifest.json @@ -62,9 +62,11 @@ "quickapp" : {}, /* 小程序特有相关 */ "mp-weixin" : { - "appid" : "wx1031981885c80917", + "appid" : "wxb35ef055a4dd8ad4", "setting" : { - "urlCheck" : false + "urlCheck" : false, + "postcss" : true, + "es6" : true }, "usingComponents" : true }, diff --git a/pages/goodsDetail/index.vue b/pages/goodsDetail/index.vue index 5cb1b5a..8ec709a 100644 --- a/pages/goodsDetail/index.vue +++ b/pages/goodsDetail/index.vue @@ -18,7 +18,7 @@ ¥{{ goods_detail.specs[0].original_price }} {{ goods_detail.specs[0].cost }} - + {{ goods_detail.specs[0].sold_stock_text }} {{ goods_detail.specs[0].stock_text }} @@ -42,15 +42,15 @@ - + - {{ goods_detail.store.address }} + {{ goods_detail.store.address }} 商品详情 - + @@ -165,6 +165,26 @@ }) }, 200); }, + // 富文本处理 + formatRichText(richText){ + if(richText != null){ + let newRichText= richText.replace(/]*>/gi, function(match, capture){ + match = match.replace(/style="[^"]+"/gi, '').replace(/style='[^']+'/gi, ''); + match = match.replace(/width="[^"]+"/gi, '').replace(/width='[^']+'/gi, ''); + match = match.replace(/height="[^"]+"/gi, '').replace(/height='[^']+'/gi, ''); + return match; + }); + newRichText = newRichText.replace(/style="[^"]+"/gi,function(match, capture){ + match = match.replace(/width:[^;]+;/gi, 'width:100%;').replace(/width:[^;]+;/gi, 'width:100%;'); + return match; + }); + newRichText = newRichText.replace(/]*\/>/gi, ''); + newRichText = newRichText.replace(/\