convert string to Dom in vuejs
If you are using Vue 2, use the v-html
directive:
<div v-html="yourVariable"></div>
A possible solution is:
Template:
<div id="log"> {{{libText}}}</div>
Notice triple {} for get raw html/text interpretation.
Javascript:
Vue.component(... , { template: ... , data: function () { return ... } }, computed: { libText:function(){ // return directly html var str="<div><p>some html</p></div>"; return str; } }, methods:{...}});