Using filter functions inside v-html

Posted 3 months ago by bufferoverflow

I have a filter function for sanitizing html like this: Vue.filter('sanitize', str => Sanitize(str));

The problem is that if I use it like this in mustaches: {{ text | sanitize }} the html get's scaped for the mustaches.

So, according to the docs, I should use v-html="" to print html. BUT, v-html doesn't work with filters.

I just want to allow the user edit a textarea with some html tags and then print unscaped (only js and some tags) to the document.

Anyone know any workaround? Thanks!

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.