Valentin
Valentin
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
@Wazbat
You may experience issues with the latest vue-tsc and vite-plugin-checker, used internally when type checking. For now, you may need to stay on v1 of vue-tsc, and follow these upstream issues for updates: fi3ework/vite-plugin-checker#306 and vuejs/language-tools#3969.
20 replies
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
20 replies
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
20 replies
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
For me this example works without TS issues :
<script setup lang="ts">
type Option = {
label: string
value: boolean | undefined
}

const value = ref<Option['value']>()

const options: Option[] = [
{
label: 'Yes',
value: true
},
{
label: 'No',
value: false
},
{
label: 'None selected',
value: undefined
}
];
</script>

<template>
{{ value }}

<USelectMenu
:options="options"
v-model="value"
value-attribute="value"
option-attribute="label"
/>
</template>
<script setup lang="ts">
type Option = {
label: string
value: boolean | undefined
}

const value = ref<Option['value']>()

const options: Option[] = [
{
label: 'Yes',
value: true
},
{
label: 'No',
value: false
},
{
label: 'None selected',
value: undefined
}
];
</script>

<template>
{{ value }}

<USelectMenu
:options="options"
v-model="value"
value-attribute="value"
option-attribute="label"
/>
</template>
(using edge)
20 replies
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
Ohh it's a SelectMenu not a UInput
20 replies
NNuxt
Created by Wazbat on 4/23/2024 in #❓・help
null values in nuxt ui input
Your problem seems to be with the boolean value. No change on the component side: https://github.com/nuxt/ui/commits/dev/src/runtime/components/forms/Input.vue
20 replies