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

"name" property please #1618

Closed Megumin2k17 closed 2 years ago

Megumin2k17 commented 2 years ago

First, thank you for this component. You are breathtaken!

Is your feature request related to a problem? Please describe. Im using vue3 in non spa project. I mean that I want to use this component in a casual html form submit with this ugly page reload. Then I run into problem - when I sent form there was no data from this component field in my request. So I find out that it seems like you can not set a "name" prop, like you do in casual html input. So there is no data from the component in request.

It seems like I have to make some work around and I created hidden input and bind value to it so I could sent my data via casual form submit. But such work around seems to look ugly in my opinion.

Describe the solution you'd like It would be nice if I could just set a prop "name" in component among other props, like in casual input and it would send it's data.

Since Im not smart person may be I have missed something and may be you can give me some advices.

willpower232 commented 2 years ago

I came here with this exact problem but apparently you have to do it yourself https://github.com/sagalbot/vue-select/issues/1415#issuecomment-904790836

sagalbot commented 2 years ago

Hi @Megumin2k17, this was a design made early on that I think still works well enough. It's just one extra line to implement a hidden input in a form:

<form>
   <v-select v-model="value" />
   <input type="hidden" :value="value" />
</form>

IMO - this is a totally reasonable API.