matik525
matik525

Reputation: 11

Vue 3 - Render component from string

I have a question. I have a component called ValidateCheckboxes. ValidateCheckboxes is a validated list of checkboxes. I pass checkboxes to this component by props. It look like that: enter image description here enter image description here I am displaying checkboxes using v-for: enter image description here but my label look like this: enter image description here

How to render custom component from string? Or maybe should I use another way to do that? It's my first question, thanks for answers. :)

I tried use v-html but it didn't work.

Upvotes: 0

Views: 1243

Answers (1)

JTinkers
JTinkers

Reputation: 1789

You should use slots, as they provide more control. If you absolutely can't do that because stuff is loaded from a file, database or otherwise fetched from API - you can look into h() and compile() - How I can render a component from a string with vue 3?

Upvotes: 0

Related Questions