Sometimes, we want to display unescaped HTML in Vue.js.
In this article, we’ll look at how to display unescaped HTML in Vue.js.
How to display unescaped HTML in Vue.js?
To display unescaped HTML in Vue.js, we can set the v-html
directive to the reactive property string with the HTML we want to display.
For instance, we write
<template>
<section v-html="desc"></section>
</template>
to add the v-html
directive to the section element and set its value to desc
to render as the content of desc
as raw HTML.
Conclusion
To display unescaped HTML in Vue.js, we can set the v-html
directive to the reactive property string with the HTML we want to display.