How to display html code received from a fetch request in vue?

Viewed 25

I am trying to implement html code that I am receiving from an api into my code in vuejs. So from the api I am getting:

<p>blah blah blah</p>
<ul>
<li>
1
</li>
<li>
2
</li>
</ul>

I am saving this chunk of code into a variable, but when I implement them in the template like this {{variable.information}} nothing shows up. How do I display this chunk of code?

Any help would be greatly appreciated

1 Answers

pass it to v-html directive in the template. Mandatory warning: Be aware of XSS vulnerabilities and only use for trusted content.

<div v-html="variable.information" /> 
Related