Hello!
We have a setup where we share a mixin through multiple Vue components, and were hoping that this plugin would work with said structure.
This is a sample of the configuration:
The mixin:
import DOMPurify from "dompurify";
export default {
props: {
description: {
type: String,
default: "",
},
},
computed: {
sanitizedDescription() {
return DOMPurify.sanitize(this.description);
},
},
};
A component (:
<template>
<div v-html="sanitizedDescription"></div>
</template>
<script>
import TextMixin from "path/to/text/mixin";
export default {
name: "ComponentName",
mixins: [ TextMixin ],
}
</script>
Using this approach we get the eslint error: "XSS potentially found: use of v-html"
Of course, adding the computed functions within each component does work as intended, but we wanted to see if it was possible to reduce repeated code.
Thanks!
Hello!
We have a setup where we share a mixin through multiple Vue components, and were hoping that this plugin would work with said structure.
This is a sample of the configuration:
The mixin:
A component (:
Using this approach we get the eslint error: "XSS potentially found: use of v-html"
Of course, adding the computed functions within each component does work as intended, but we wanted to see if it was possible to reduce repeated code.
Thanks!