🎈 perf(秒懂百科):文本可以复制且图片可以点击保存

This commit is contained in:
Haiyi 2022-12-14 14:19:35 +08:00
parent ed49647747
commit 1cb248cfb8
2 changed files with 21 additions and 2 deletions

View File

@ -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`

View File

@ -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 (
<Popup showTitle={false} show={param.showPopup} onClose={() => param.closePopup?.()}>
<ScrollView scrollY className={styles.sollBox}>
<View className={styles.main}>
<View className={styles.title}>{param?.productName}</View>
<View className={styles.line}></View>
<RichText nodes={nodes}></RichText>
<RichText nodes={nodes} userSelect onTap={() => richTextClick()}></RichText>
{/* <rich-text nodes={nodes} catchtap={() => richTextClick()}></rich-text> */}
<View className={styles.topFont}></View>
{
list.map((item, index) => {