后端返回数据是带着html标签,渲染时不需要
返回数据如下:
解决如下:
methods: {
// 去除html标签
stripHtml(html) {
const tempDiv = document.createElement("div");
tempDiv.innerHTML = html;
return tempDiv.innerText || tempDiv.textContent || "";
},
},
使用:
<div class="custom-supplies" v-text="stripHtml(scope.row.suppliesDetails)"></div>
推荐阅读:
扫描二维码,在手机上阅读