-
Notifications
You must be signed in to change notification settings - Fork 462
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
feat(SelectMenu): add value-attribute
prop
#429
Conversation
✅ Live Preview ready!
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could add an example of this under the select-menu-example-objects
one?
I've added a callout in 7c2a401 saying that the display might be broken as this line is not suited to work with the new I thought of using a computed like so instead : const modelValueLabelToDisplay = computed(() => {
if (!props.modelValue) {
return undefined
}
if (props.valueAttribute && typeof props.modelValue !== 'object') {
const current = (props.options as { [key: string]: any, disabled?: boolean }[]).find((option) => option[props.valueAttribute] === props.modelValue)
return current[props.optionAttribute]
}
if (typeof props.modelValue === 'string') {
return props.modelValue
}
return props.modelValue[props.optionAttribute]
}) But it would have broke with the |
value-attribute
prop
Why is your callout mentioning the |
In multiple mode it displays Maybe I'll just display the example with the |
Resolves #415
Resolves #262
Add the possibility to specify which key of an array of objects can be picked in the
modelValue
Sometimes, you need the whole objects only for display purposes, but the bound values are needed to be only one attribute of those objects
The image below depict how it works with the the
value-attribute="id"
prop on theselect-menu#async-search
section of the docsMaybe we should add a note telling that
by
andvalue-attribute
are completely different mechanism?What are your thoughts on such a feature?