WeAutocomplete
v-combobox whose suggestions are loaded from an API resource (through usePaginatedFetch). Unlike we-select, the user can also type a free value. The search text is sent to the server as search (debounced); with paginate more items are loaded when the end of the list is reached.
Usage
vue
<template>
<we-autocomplete
v-model="user"
resource="users"
item-title="full_name"
item-value="id"
label="User"
clearable
/>
</template>
<script setup lang="ts">
const user = ref(null)
</script>v-model and every other attribute (item-title, item-value, return-object, chips, rules, ...) are passed to v-combobox.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
resource | string | -- | Required. API resource to fetch suggestions from |
extraParams | object | {} | Extra query params (read once at setup) |
multiple | boolean | false | Treats the model as an array when merging selected values into the items |
paginate | boolean | { limit: number } | false | Server pagination (default limit 50) with infinite scroll; disables client-side filtering |
clearable | boolean | false | Clear icon (never shown while readonly) |
readonly | boolean | null | Read-only |
disabled | boolean | null | Disabled |
readonly and disabled default to null: in that case they are inherited from the parent v-form.
Events
| Event | Payload | Description |
|---|---|---|
error | Error | API request failed |
update:modelValue and the other events come from v-combobox.