How to render a raw HTML in Vuejs?

In the post Render the HTML raw in React app we already know how to render a raw HTML in a React app. Today we will do it in a Vuejs app.

In Vuejs we use v-html directive to render the raw HTML content, it's very easy too:

Your Vuejs scripts:




Your Vuejs template:




The result will be:



Warning Dynamically rendering arbitrary HTML on your website can be very dangerous because it can easily lead to XSS vulnerabilities.
Only use HTML interpolation on trusted content and never on user-provided content.


© 2019 4codev

Created with love by Sil.