From 2e15656ab98c29f2e4c311361ef41d71a6f08a0c Mon Sep 17 00:00:00 2001 From: alvarosabu Date: Tue, 17 Nov 2026 16:07:55 +0100 Subject: [PATCH 1/4] feat(Select/SelectMenu): expose selected `item` in trigger slots The `#leading`, `#default` and `#trailing` slots now receive `item`: the item that matches `modelValue`, or an array of matching items with `multiple`. With `value-key`, slots no longer have to search `items` to read the selected item's icon, avatar or chip. --- .../examples/select/SelectFetchExample.vue | 10 ++-- .../select/SelectItemsChipExample.vue | 10 ++-- docs/content/docs/2.components/select-menu.md | 4 ++ docs/content/docs/2.components/select.md | 10 ++-- .../nuxt/app/pages/components/select-menu.vue | 16 ++++++ .../nuxt/app/pages/components/select.vue | 31 ++++++----- src/runtime/components/Select.vue | 39 +++++++++++--- src/runtime/components/SelectMenu.vue | 53 ++++++++++++------- src/runtime/types/utils.ts | 8 +++ src/runtime/utils/index.ts | 44 +++++++++++++-- test/components/Select.spec.ts | 32 +++++++++++ test/components/SelectMenu.spec.ts | 35 ++++++++++++ test/utils/index.spec.ts | 43 +++++++++++++++ 13 files changed, 273 insertions(+), 62 deletions(-) diff --git a/docs/app/components/content/examples/select/SelectFetchExample.vue b/docs/app/components/content/examples/select/SelectFetchExample.vue index d08bd79b0c..5e62b4e5a8 100644 --- a/docs/app/components/content/examples/select/SelectFetchExample.vue +++ b/docs/app/components/content/examples/select/SelectFetchExample.vue @@ -13,10 +13,6 @@ const { data: users, status, execute } = await useLazyFetch('https://jsonplaceho immediate: false }) -function getUserAvatar(value: string) { - return users.value?.find(user => user.value === value)?.avatar || {} -} - function onOpen() { if (!users.value?.length) { execute() @@ -34,10 +30,10 @@ function onOpen() { class="w-48" @update:open="onOpen" > -