From 1cb248cfb83c29a0921f288f55839428c5cb408d Mon Sep 17 00:00:00 2001 From: Haiyi <1021441632@qq.com> Date: Wed, 14 Dec 2022 14:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=88=20perf(=E7=A7=92=E6=87=82=E7=99=BE?= =?UTF-8?q?=E7=A7=91):=E6=96=87=E6=9C=AC=E5=8F=AF=E4=BB=A5=E5=A4=8D?= =?UTF-8?q?=E5=88=B6=E4=B8=94=E5=9B=BE=E7=89=87=E5=8F=AF=E4=BB=A5=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E4=BF=9D=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/constant.ts | 2 +- .../details/components/feature/index.tsx | 21 ++++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/common/constant.ts b/src/common/constant.ts index 32af514..f6888af 100644 --- a/src/common/constant.ts +++ b/src/common/constant.ts @@ -1,4 +1,4 @@ -// export const BASE_URL = CURRENT_BASE_URL +export const BASE_URL = CURRENT_BASE_URL // export const BASE_URL = `http://192.168.0.75:50001/lymarket` // export const BASE_URL = `http://192.168.0.89:50001/lymarket` // export const BASE_URL = `http://10.0.0.5:50001/lymarket` diff --git a/src/pages/details/components/feature/index.tsx b/src/pages/details/components/feature/index.tsx index e3ee7fe..eb25d68 100644 --- a/src/pages/details/components/feature/index.tsx +++ b/src/pages/details/components/feature/index.tsx @@ -46,13 +46,32 @@ const FeaturePopup = (param: Props) => { } }, [showPopup]) + // 用户预览图片 + const richTextClick = () => { + // 富文本 + const richContent = nodes + // 判断含有图片 + if (richContent.includes('src')) { + const imgs: any[] = [] + richContent.replace(/]*src=['"]([^'"]+)[^>]*>/gi, (match, capture): any => { + imgs.push(capture) + }) + + Taro.previewImage({ + current: imgs[0], // 以后显示图片的http链接 + urls: imgs, + }) + } + } + return ( param.closePopup?.()}> {param?.productName} - + richTextClick()}> + {/* richTextClick()}> */} 推荐面料 { list.map((item, index) => {