Files
ui/docs/components/content/examples/CommandPaletteExampleAsync.vue
Benjamin Canac b2e0566c16 docs: typecheck
2024-07-23 11:51:02 +02:00

20 lines
462 B
Vue

<script setup lang="ts">
const groups = [{
key: 'users',
label: q => q && `Users matching “${q}”...`,
search: async (q) => {
if (!q) {
return []
}
const users: any[] = await $fetch('https://jsonplaceholder.typicode.com/users', { params: { q } })
return users.map(user => ({ id: user.id, label: user.name, suffix: user.email }))
}
}]
</script>
<template>
<UCommandPalette :groups="groups" :autoselect="false" />
</template>