How to display unescaped HTML in Vue.js?

Spread the love

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 use the v-html directive.

For instance, we write

<template>
  <div v-html="task.htmlContent"></div>
</template>

to render the task.htmlContent string’s HTML code without escaping.

Conclusion

To display unescaped HTML in Vue.js, we use the v-html directive.

Leave a Reply

Your email address will not be published. Required fields are marked *