1. 解释v-dompurify-html是什么 v-dompurify-html 是一个Vue.js指令,用于在Vue组件中安全地处理和渲染HTML内容。它基于DOMPurify库,后者是一个流行的HTML清理库,能够移除潜在的恶意内容,从而防止跨站脚本攻击(XSS)。 2. 阐述v-dompurify-html在Vue.js中的用途 在Vue.js中,v-dompurify-html的主要用途是确保从外部...
import { createApp } from 'vue'; import App from './App.vue'; import VueDOMPurifyHTML from 'vue-dompurify-html'; const app = createApp(App); app.use(VueDOMPurifyHTML, { default: { USE_PROFILES: { html: false }, }, }); app.mount('#app');...
import{ createApp }from'vue';importAppfrom'./App.vue';importVueDOMPurifyHTMLfrom'vue-dompurify-html';constapp = createApp(App); app.use(VueDOMPurifyHTML); app.mount('#app'); In yourSFC: <template><divv-dompurify-html="rawHtml"></div></template><scriptsetup>import{ ref }from'vue';c...
vue-dompurify-html/LICENSE Version: 1.07 kBPlain TextView Raw 1 MIT License 2 3 Copyright (c) 2019-2022 Thomas Gerbet 4 5 Permission is hereby granted, free of charge, to any person obtaining a copy 6 of this software and associated documentation files (the "Software"), to deal...
一、引出vue-dompurify-html v-html可能引起跨站脚本攻击(Cross-Site Scripting 简称 XSS)。 所以,在网站上动态渲染任意 HTML 是非常危险的,因为容易导致 [XSS攻击]。只在可信内容上使用 v-html,永不用在用户提交的内容上。 仅用于展示的内容个人觉得可以使用。为了避免出现特殊情况,本文介绍一个插件“vue-dompurify...
npm install vue-dompurify-html@vue-legacy Usage importVuefrom'vue'importVueDOMPurifyHTMLfrom'vue-dompurify-html'Vue.use(VueDOMPurifyHTML)newVue({el:'#app',data:{rawHtml:'<span style="color: red">This should be red.</span>'}}) In your template: ...
LeSuisse/vue-dompurify-htmlPublic Sponsor NotificationsYou must be signed in to change notification settings Fork21 Star289 Code Issues3 Pull requests Actions Security Insights Additional navigation options Commit Browse files main (#2835) v5.1.0 ...
Safe replacement for the v-html directive. Contribute to LeSuisse/vue-dompurify-html development by creating an account on GitHub.
vue-dompurify-html/types/index.d.ts Version: 403 BTypeScriptView Raw 1importtype{ Plugin }from'vue'; 2importtype{ DirectiveConfig, MinimalDOMPurifyConfig, DOMPurifyInstanceBuilder }from'./dompurify-html'; 3exporttype{ DirectiveConfig, MinimalDOMPurifyConfig, DOMPurifyInstanceBuilder, }; ...
npm install vue-dompurify-html@vue-legacy Usage importVuefrom'vue'importVueDOMPurifyHTMLfrom'vue-dompurify-html'Vue.use(VueDOMPurifyHTML)newVue({el:'#app',data:{rawHtml:'<span style="color: red">This should be red.</span>'}}) In your template: ...