富文本内容提取里面的中文信息

150 阅读1分钟

methods方法

   extractChineseText(text) {
     const pattern = /[\u4e00-\u9fa5]/g // Regular expression to match Chinese characters
     const chineseText = text.match(pattern).join('') // Extract Chinese characters and join them
     return chineseText
   },

表格展示

    <span slot="candidate_info" slot-scope="text">
        <ellipsis :length="15" tooltip>{{ extractChineseText(text) }}</ellipsis>
      </span>

前后对比图

image.png