vue-3-sanitize
vue-3-sanitize
HTML sanitizer for Vue.js 3 apps.
You want to use v-html? You might need to sanitize the code. This plugin is built for Vue 3 apps. It is built upon on sanitize-html.
Install
yarn add vue-3-sanitize
# or
npm install --save vue-3-sanitize
Usage
Registration
Register the plugin
import Vue3Sanitize from "vue-3-sanitize";
// const app = createApp(YourVue3App);
app.use(Vue3Sanitize);
To override the default options of sanitize-html, pass them as an argument. It is not supported to merge them.
const overridenOptions = {
allowedTags: ['img']
};
app.use(Vue3Sanitize, overridenOptions);
Template
<template>
<p v-html="$sanitize(dirty)" />
</template>
Issues
If you find any bugs, please open an issue.
Contributing
- Fork it
- Create your feature branch:
git checkout -b feature-or-bugfix - Add your changes:
git add files - Commit your changes:
git commit -m "Add some feature" - Push to the branch:
git push origin feature-or-bugfix - Submit a forked pull request
License
See License File.
Related Packages
@xunlei/vue-lazy-component
Vue.js 2.0 组件级懒加载方案 Vue.js 2.x component level lazy loading solution
14,137
1,003
Version History
| Version | Released | License |
|---|---|---|
| 0.1.4 | MIT | |
| 0.1.3 | MIT | |
| 0.1.2 | MIT | |
| 0.1.1 | MIT |