<rich-text nodes="{{details.Content}}" space="ensp" catchtap="catchImage"></rich-text>
catchImage(e) {
// 富文本点击事件
// 富文本
const richContent = this.data.details.Content;
// 判断含有图片
if (richContent.indexOf("src") >= 0) {
const imgs = [];
richContent.replace(/]*src=['"]([^'"]+)[^>]*>/gi, function (match, capture) {
imgs.push(capture);
})
wx.previewImage({
current: imgs[0], // 当前显示图片的链接
urls: imgs
})
}
},
小程序rich-text中实现图片预览
最新推荐文章于 2024-05-17 17:15:50 发布