[Vuejs]-Strange escaping behaviour with Vue.js

0👍

One way to do this is to use the <component :is="tag"> For example:

var demo = new Vue({
  el: '#demo',

  data() {
    return {
      tag: 'button',
      othertag: 'hr'
    }
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div v-html id="demo">
  <component :is="tag">hello</component>
  <component :is="othertag"></component>
  
</div>

Leave a comment