AgnosticUI / agnosticui

AgnosticUI is a set of UI primitives that start their lives in clean HTML and CSS. These standards compliant components are then copied to our framework implementations in: React, Vue 3, Angular, and Svelte.
https://agnosticui.com
Apache License 2.0
723 stars 47 forks source link

Vue.js v-model binding does not work with Select #264

Open cengique opened 7 months ago

cengique commented 7 months ago

Your documentation is great, but missing examples for dynamic binding. For Select, this does not update levels:

<Select v-model="levels" ...>

and gives a warning:

[Vue warn]: Extraneous non-props attributes (selected) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.

which happens because there are multiple fragments to select from. There is a <label> tag before <select> in the definition of the Select component.

For Input, v-model works fine:

<Input type="text" v-model="search_text" />

I was able to get Select to work by digging into your source code:

<Select @selected="(value) => { levels = value }" ...>

Is this a good solution? I wish the emitted events or some dynamic binding info was listed in the help page. I saw some discussion on this in #147, but wasn't sure what it resulted in. Thanks!