data() {
return {
richText: '<p>This is a<br>rich-text<br>example.</p>'
}
},
onLoad() {
},
methods: {
copyText() {
uni.setClipboardData({
data: this.stripHtml(this.richText),
success: ()=> {
uni.showToast({
title: '复制成功',
icon: 'none'
});
}
});
},
stripHtml(str){
return str.replace(/<[^<>]+>/g,"").replace(/ /gi,"");
},
}
正则:从富文本中复制出纯文字
猜你喜欢
转载自blog.csdn.net/qq_40745143/article/details/132233805
今日推荐
周排行