小程序提取富文本中的文字并指定长度

2019-04-05  本文已影响0人  张大娃创业笔记
getSimpleText(html){
    var re1 = new RegExp("<.+?>", "g");//匹配html标签的正则表达式,"g"是搜索匹配多个符合的内容
    var msg = html.replace(re1, '');//执行替换成空字符
    return msg;
  }
//调用
that.getSimpleText(item.des_ppcontent).substring(0,20)
上一篇下一篇

猜你喜欢

热点阅读