getSimpleText(html){
var re1 = new RegExp("<.+?>", "g");//匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
var msg = html.replace(re1, '');//执行替换成空字符
return msg;
}
//调用
that.getSimpleText(item.des_ppcontent).substring(0,20)
getSimpleText(html){
var re1 = new RegExp("<.+?>", "g");//匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
var msg = html.replace(re1, '');//执行替换成空字符
return msg;
}
//调用
that.getSimpleText(item.des_ppcontent).substring(0,20)
本文标题:小程序提取富文本中的文字并指定长度
本文链接:https://www.haomeiwen.com/subject/imxliqtx.html
网友评论