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...
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/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: ...
业务需求需要在自己的网页上嵌入油管( youtube )上的视频,所以去踩了油管 IFrame Player API 的坑...
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.yml/badge.svg?branch=main)](https://github.com/LeSuisse/vue...
Safe replacement for the v-html directive. Contribute to LeSuisse/vue-dompurify-html development by creating an account on GitHub.
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...