Reputation: 7022
I am developing an application using Laravel & Vue.js. I have some data in database like Hello <b>world!</b>
. How can I display them as Hello world! ?
Upvotes: 0
Views: 2014
Reputation: 56754
Use the v-html
binding:
<p v-html="fromDB"></p>
assuming you have a fromDB
property in your viewmodel like e.g.
data() {
return {
fromDB: 'Hello <b>world!</b>'
}
}
Example:
https://codesandbox.io/s/2po80169wy
Reference:
Please be aware that this comes with a risk since from your database, fromDB
can become just about anything, e.g. <script>console.log('logged')</script>
.
Upvotes: 6