In Vue JS, the v-html
directive is used to change the content of an HTML element. It is similar to the DOM innerHtml
property.
v-html
accepts a single parameter, data, as input and renders it into HTML.
v-html="data"
First, we created a div
element with an id app
, and applied the v-html
directive to it with data as the input.
Then, we created a message by initializing a new Vue instance with the data property containing our message.