mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 20:19:34 +01:00
27 lines
492 B
Vue
27 lines
492 B
Vue
<script setup lang="ts">
|
|
const loading = ref(false)
|
|
const selected = ref()
|
|
|
|
async function search (q: string) {
|
|
loading.value = true
|
|
|
|
const users: any[] = await $fetch('https://jsonplaceholder.typicode.com/users', { params: { q } })
|
|
|
|
loading.value = false
|
|
|
|
return users
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<UInputMenu
|
|
v-model="selected"
|
|
:search="search"
|
|
:loading="loading"
|
|
placeholder="Search for a user..."
|
|
option-attribute="name"
|
|
trailing
|
|
by="id"
|
|
/>
|
|
</template>
|