-
Notifications
You must be signed in to change notification settings - Fork 764
InputMenu / SelectMenu type issue #3718
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
Comments
Hey @benjamincanac! It looks like the For now, I’m rolling back to Here’s a minimal reproduction: cc @sandros94 |
Indeed that PR is the cause of this change, but in reality it was a fix and now working as intended. The To have proper typing you should add your own key like for example <template>
<UApp>
<div class="h-screen grid place-items-center">
<USelectMenu v-model="selectedValue" :items="menuItems" value-key="data" class="w-56" />
</div>
</UApp>
</template>
<script setup lang="ts">
import { ref } from 'vue'
type Value = {
name: string
id: string
}
const selectedValue = ref<Value>()
const menuItems: { label: string, data: Value }[] = [
{ label: 'Item 1', data: { id: '1', name: 'First example' } },
{ label: 'Item 2', data: { id: '2', name: 'Other example' } },
]
</script> |
Tho I'm considering a few alternatives to make this easier to understand/predict |
Environment
Is this bug related to Nuxt or Vue?
Nuxt
Version
v3.0.2
Reproduction
Description
One week ago i have opened this issue on v3.0.1 : #3670
But now it's a lot worse, we can't pass array of custom object we're obliged to use
SelectMenuItem[]
orInputMenuItem[]
, and the issue withlabel-key
props is not solved now I have this typescript error :Cannot assign type 'string' to type 'undefined'.ts-plugin(2322)
.I really appreciate your work on the V3 this version is a lot better than V2, but in our project we can't fit for each select your data structure we need to use custom object (like in the V2).
Additional context
No response
Logs
The text was updated successfully, but these errors were encountered: