Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Select custom default value #7296

Closed
1 task
DaveDev13 opened this issue Jan 18, 2024 · 3 comments
Closed
1 task

Select custom default value #7296

DaveDev13 opened this issue Jan 18, 2024 · 3 comments
Labels

Comments

@DaveDev13
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

4.1.0

Environment

Vue 3.2.47

Reproduction link

Edit on CodeSandbox

Steps to reproduce

See the link

What is expected?

I will see the first item as selected by default

What is actually happening?

See the link


The value specified in formData.organizations should be displayed as the first selected element in the selector

I thought that the values specified in :options would be compared with the values specified in v-model:value, in fact this is what happens, but the data specified in :field-names="{ label: 'name', value: 'id' }" do not affect the first selected item by default

@qppq54s
Copy link

qppq54s commented Jan 27, 2024

need to set formData.organizations=['1'] because v-model:value just bind selected value

@DaveDev13
Copy link
Author

DaveDev13 commented Feb 1, 2024

необходимо установить formData.organizations=['1'], потому что v-model:value просто привязывает выбранное значение

Thanks for the answer, it really works. But then I don't understand what are the label-in-value and field-names properties needed for?
I'll explain the case, I want to get data from the backend in the { id: "1", name: "First" } format, and just transfer them to the select, without doing unnecessary manipulation to transform the data, and after selecting the desired value, also give the data in the { id: "1", name: "First" } format

Copy link

github-actions bot commented Apr 2, 2024

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants