Skip to content

USelectMenu create-item="always" not working #3949

@projct1

Description

@projct1

Environment

Is this bug related to Nuxt or Vue?

Nuxt

Version

Nuxt UI version 3.0.2

Reproduction

<script setup lang="ts">
const model = defineModel()

const query = ref('')
const items = ref([])

const isOpen = ref(false)
const isLoading = ref(false)

const search = useDebounceFn(async () => {
  if (query.value.length > 1) {
    isLoading.value = true

    items.value = (await fetchApi('categories?q=' + query.value)).data

    isLoading.value = false
  }
}, 250)

function create(name) {
  model.value = { name: name.trim() }

  query.value = ''
  isOpen.value = false
}
</script>

<template>
  <USelectMenu v-model="model"
               v-model:open="isOpen"
               v-model:search-term="query"
               :items="items"
               :loading="isLoading"
               label-key="name"
               create-item="always"
               @create="create"
               @update:search-term="search" />
</template>

Description

I want to create new category "Des", but cant, because i found "Deserts".
Option create-item="always" ignored.

Demonstration: https://skr.sh/vVFQ3lvSifh

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions