每个逗号换行一次
vue代码
<td v-html="cutout(item.sMonday)"></td>
methods代码
cutout (cellValue) {
return cellValue.replace(/\,/g, '</br>')
},
每两个逗号换行一次
vue代码
<td v-html="cutout(item.sMonday)"></td>
methods代码
cutout (cellValue) {
var reg = /[,,]/g;
var index = 1;
return cellValue.replace(reg, function () { index++; return index % 2 ? '\n' : arguments[0] })
},