How to use v-html in render function?

Hi guys,

I’m trying to render an input component without template (only render function) so I need to add a label who use v-html in template, but how to render a raw html in my createElement function ?

<div v-html="myContent"></div>

to

data: () => ({
  myContent: '<span>toto</span>'
}),
render (ce) {
  return ce('div', this.myContent)
}

any subjections ?

thanks in advance for your help :stuck_out_tongue:

1 Like
ce('div', {domProps:{innerHTML:this.myContent}})

This is what v-html turns into when compiled

10 Likes

this is perferct, thanks @Herteby !

@Herteby is there a way to attach $attrs to myContent?

domProps not working with Vue 3 to render raw HTML