ant-design-vue
ant-design-vue copied to clipboard
Select custom default value
- [ ] 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
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
need to set formData.organizations=['1'] because v-model:value just bind selected value
необходимо установить 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
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