使用v-html只能解析成正确的html代码,不能展示效果
可以先转化为为正确的html再解析
以下代码$符号需改成&符号
function htmlDecode(html) {
return html.replace(/$lt;|$gt;|$quot;|$amp;/g, match => {
switch(match) {
case '$lt;':
return '<';
case '$gt;':
return '>';
case '$quot;':
return '"';
case '$amp;':
return '&';
}
})
}
