1、使用vue指令:v-html
// content='<p>我是帶標簽的字符串</p>'
<span v-html="content"></span>
2、使用正則表達式
// 去掉html字符串中的所有標簽元素
export function delHtmlTag (str) {
return str.replace(/<[^>]+>/g, '')
}
// 使用 content='<p>我是帶標簽的字符串</p>'
<span>{{ delHtmlTag(content) }}</span>