mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Benjamin Canac <canacb1@gmail.com>
18 lines
578 B
Vue
18 lines
578 B
Vue
<script setup lang="ts">
|
|
const { data: users } = await useFetch('https://jsonplaceholder.typicode.com/users', {
|
|
key: 'command-palette-users',
|
|
transform: (data: { id: number, name: string, email: string }[]) => {
|
|
return data?.map(user => ({ id: user.id, label: user.name, suffix: user.email, avatar: { src: `https://i.pravatar.cc/120?img=${user.id}` } })) || []
|
|
},
|
|
lazy: true
|
|
})
|
|
</script>
|
|
|
|
<template>
|
|
<UCommandPalette
|
|
:groups="[{ id: 'users', items: users || [] }]"
|
|
:fuse="{ fuseOptions: { includeMatches: true } }"
|
|
class="flex-1 h-80"
|
|
/>
|
|
</template>
|