sagalbot / vue-select

Everything you wish the HTML <select> element could do, wrapped up into a lightweight, extensible Vue component.
https://vue-select.org
MIT License
4.62k stars 1.33k forks source link

Can't set initial value in usage with FormKit #1694

Closed thodelcros closed 1 year ago

thodelcros commented 1 year ago

Describe the bug I am trying to connect my vue-select component to FormKit (documentation).

I can't manage to pass an initial value to my vue-select component, despite using the value prop, and despite the BaseSelect component receiving value from FormKit by context.node.value object.

Reproduction Link https://stackblitz.com/edit/nuxt-starter-ref6ut?file=BaseSelect.vue

Steps To Reproduce As you can see, in the BaseSelect.vue file, the context.node.value variable, binded to the :value prop, does not hydrate the VSelect component with initial value.

Expected behavior VSelect component should render "bar" in the input, as it is while you select manually an option. ("bar" is being set as initial value in FormKit, in app.vue)

sagalbot commented 1 year ago

The valueprop is removed in the v4 in favour of the Vue 3 modelValue prop used for v-model bindings. The docs for vue select right now are not great, which was likely the source of your issue. Swap the prop and you're good to go.