Vue Dynamic HTML Tag
Using render function
HTML
<div id="vue">
<input v-model="tag">
<tag :is="tag">Hello, world!</tag>
</div>
JavaScript
Vue.component('tag', {
props:{
is:{type:String, required:true}
},
render(h){
return h(this.tag, this.$slots.default)
}
})
new Vue({
el:'#vue',
data(){
return {
tag:'div'
}
}
})