数组 · 长文字以句号分隔为段落(String => Array)

328 阅读1分钟

JS

this.descList = this.desc.split(/[。]/).filter(m => m !== '');

HTML

<p class='padding' v-for="(item,index) in descList" :key="index">
  {{item}}
</p>

多个标签以逗号分割为标签(两种逗号)

let tabList = this.tabDesc.split(/[,,]/).filter(m => m !== '');