mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-19 06:21:46 +01:00
docs(SelectMenu): improve async search example
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<script setup>
|
||||
const loading = ref(false)
|
||||
const selected = ref([])
|
||||
|
||||
async function search (q) {
|
||||
loading.value = true
|
||||
|
||||
const users = await $fetch('https://jsonplaceholder.typicode.com/users', { params: { q } })
|
||||
|
||||
loading.value = false
|
||||
|
||||
return users
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<USelectMenu
|
||||
v-model="selected"
|
||||
:loading="loading"
|
||||
:searchable="search"
|
||||
placeholder="Search for a user..."
|
||||
option-attribute="name"
|
||||
multiple
|
||||
trailing
|
||||
by="id"
|
||||
/>
|
||||
</template>
|
||||
Reference in New Issue
Block a user