vue-dompurify-html 是一个为 Vue.js 设计的安全 HTML 渲染替换组件,它基于 DOMPurify 库进行封装,用于过滤和处理 HTML 内容以防止跨站脚本攻击(XSS)。以下是关于 vue-dompurify-html 的详细使用指南: 1. 安装 vue-dompurify-html 包 首先,你需要在你的 Vue 项目中安装 vue-dompurify-html。你可以使用 npm 或...
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');...
二、npm vue-dompurify-html - npm 三、nuxt3项目使用 3.1、安装vue-dompurify-html pnpm add vue-dompurify-html 3.2、plugins/vueInject.js // 防止使用v-html发生跨站脚本攻击XSSimport VueDOMPurifyHTML from 'vue-dompurify-html'export default defineNuxtPlugin(nuxtApp => {nuxtApp.vueApp.use(VueDOMPurify...
1.首先,您需要安装DOMPurify库。在命令行中运行以下命令: ``` npm install dompurify ``` 2.在需要使用DOMPurify的Vue组件中,导入DOMPurify库: ```vue import DOMPurify from 'dompurify'; ``` 3.在Vue组件中,您可以在需要净化HTML的地方使用DOMPurify,例如在模板中使用插值绑定: ```vue <template> </te...
vue-dompurify-html A "safe" replacement for thev-htmldirective. The HTML code is sanitized withDOMPurifybefore being interpreted. This is only a small wrapper around DOMPurify to ease its usage in a Vue app. You should take a look at theDOMPurify Security Goals & Threat Modelto understand wh...
npm install vue-dompurify-html@vue-legacy Usage importVuefrom'vue'importVueDOMPurifyHTMLfrom'vue-dompurify-html'Vue.use(VueDOMPurifyHTML)newVue({el:'#app',data:{rawHtml:'This should be red.'}}) In your template: You can also define yourDOMPurify configurations...
业务需求需要在自己的网页上嵌入油管( youtube )上的视频,所以去踩了油管 IFrame Player API 的坑...
vue-dompurify-html/README.md Version: 4.66 kBMarkdownView Raw 1# vue-dompurify-html 2 3[![npm](https://img.shields.io/npm/v/vue-dompurify-html)](https://www.npmjs.com/package/vue-dompurify-html) 4[![Build Status](https://github.com/LeSuisse/vue-dompurify-html/actions/workflows/CI...
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, }; ...
Safe replacement for the v-html directive. Contribute to LeSuisse/vue-dompurify-html development by creating an account on GitHub.