使用vue-dompurify-html插件
//安裝
cnpm install vue-dompurify-html
//引入
import VueDOMPurifyHTML from 'vue-dompurify-html'
Vue.use(VueDOMPurifyHTML)
//使用
<div v-dompurify-html="content"></div>
比如說(shuō)我們?cè)阡秩靖晃谋揪庉嫷奈恼聲r(shí)嘹朗,使用XSS會(huì)把calss侥衬,style過(guò)濾掉,那樣就渲染不出來(lái)了血久。所以使用vue-dompurify-html突照,防止xss注入