Replies: 2 comments 6 replies
-
If this sounds like a reasonable solution, I am happy to submit a PR. |
Beta Was this translation helpful? Give feedback.
-
A workaround I see in the wild is creating Vue components wrapping the custom elements, and creating its own version of For example, this is how the great And here you can see how it's used for |
Beta Was this translation helpful? Give feedback.
-
I am building a library with custom elements. Vue does a great job with custom elements, but the one issue I've run into is with supporting
v-model
.Setting
app.config.compilerOptions.isCustomElement
works well for text input components where I can emit aninput
event and use avalue
prop, but I am unable to support checkboxes and radio buttons sinceV_MODEL_DYNAMIC
is looking forevent.target.value
instead ofevent.target.checked
.The workaround here is to set a
type
on the host element like this:While this works, it's another item for users to remember that I'd prefer for them to be able to configure globally in their app. I have tried setting
type
on the host element when the component mounts, butv-model
seems to have already initialized.Potential solution
isCustomElement
could return an optionaltype
thattransformModel
could use to select the correctv-model
.For example:
Beta Was this translation helpful? Give feedback.
All reactions