I use {{}} in Vue.js to render my data to HTML. But now I got a string in my data, and I want the
tags in that string can be parsed into HTML tags when rendering data.
data(){
return {
bodyText: 'aaaaaa<br>aaaaaa'
}
}
<p>{{bodyText}}</p>
I want the content in span tag is like :
aaaaaa
aaaaaa
But the result is :
aaaaaa<br>aaaaaa
I think it should work using this:
<p>Using v-html directive: <span v-html="rawHtml"></span></p>
Use v-html
directive:
<p><span v-html="bodyText"></span></p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With