Documentation Index Fetch the complete documentation index at: https://mintlify.com/7span/vue-list/llms.txt
Use this file to discover all available pages before exploring further.
The VueList component is the main container that manages state, data fetching, and provides context to all child components.
Props
API endpoint URL for fetching data. This is passed to the request handler as part of the context. < VueList endpoint = "/api/users" >
<!-- ... -->
</ VueList >
Additional request payload to include with every request. The request handler will receive this in the context object. < VueList
endpoint = "/api/users"
: meta = " { teamId: 123 , includeInactive: false } "
>
<!-- ... -->
</ VueList >
Filter object that is reactive. Use v-model:filters for two-way binding. When filters change, the list automatically refetches data and resets to page 1. < script setup >
import { ref } from 'vue'
const filters = ref ({
status: 'active' ,
role: null
})
</ script >
< template >
< VueList
endpoint = "/api/users"
v-model : filters = " filters "
>
<!-- ... -->
</ VueList >
</ template >
Initial page number to load. This is only the initial value - the actual page state is managed internally by the component. < VueList endpoint = "/api/users" : page = " 2 " >
<!-- ... -->
</ VueList >
Number of items to fetch per page. This is the initial value - the actual state is managed internally. < VueList endpoint = "/api/users" : per-page = " 50 " >
<!-- ... -->
</ VueList >
Column/field name to sort by initially. The actual sort state is managed internally. < VueList endpoint = "/api/users" sort-by = "created_at" >
<!-- ... -->
</ VueList >
sortOrder
'asc' | 'desc'
default: "'desc'"
Initial sort direction. Must be either 'asc' (ascending) or 'desc' (descending). < VueList
endpoint = "/api/users"
sort-by = "name"
sort-order = "asc"
>
<!-- ... -->
</ VueList >
Initial search query. The actual search state is managed internally. < VueList endpoint = "/api/users" search = "john" >
<!-- ... -->
</ VueList >
List of attribute names to display in the list. Can be an array of strings or objects. If not provided, keys from the first response item will be used. <!-- Simple array of strings -->
< VueList
endpoint = "/api/users"
: attrs = " [ 'name' , 'email' , 'created_at' ] "
>
<!-- ... -->
</ VueList >
<!-- Array of objects for more control -->
< VueList
endpoint = "/api/users"
: attrs = " [
{ name: 'name' , label: 'Full Name' },
{ name: 'email' , label: 'Email Address' },
{
name: 'address' ,
label: 'Address' ,
attrs: [ 'street' , 'city' , 'zip' ]
}
] "
>
<!-- ... -->
</ VueList >
Show Attribute Object Structure
When using objects in the attrs array:
name (string, required): The field name
label (string): Display label (auto-generated if not provided)
attrs (array): Nested attributes for complex objects
Custom request handler function for this specific list. Overrides the global request handler defined in plugin options. < script setup >
const customRequestHandler = async ( requestData ) => {
const response = await fetch ( '/api/custom-endpoint' , {
method: 'POST' ,
body: JSON . stringify ( requestData )
})
const data = await response . json ()
return {
items: data . results ,
count: data . totalCount
}
}
</ script >
< template >
< VueList
endpoint = "/api/users"
: request-handler = " customRequestHandler "
>
<!-- ... -->
</ VueList >
</ template >
version
string | number
default: "1"
Version identifier for the list configuration. Used by the state manager to identify when configuration changes and clean up stale states. < VueList
endpoint = "/api/users"
: version = " 2 "
>
<!-- ... -->
</ VueList >
Increment the version number when you make significant changes to the list configuration, such as changing filters or attributes.
Enable pagination history in the URL. When enabled, the current page number is added to the URL as a query parameter. <!-- URL will include ?page=2, ?page=3, etc. -->
< VueList
endpoint = "/api/users"
: has-pagination-history = " true "
>
<!-- ... -->
</ VueList >
<!-- URL won't change -->
< VueList
endpoint = "/api/users"
: has-pagination-history = " false "
>
<!-- ... -->
</ VueList >
Pagination mode to use:
'pagination': Standard pagination with page numbers
'loadMore': Load more button that appends items to the existing list
<!-- Standard pagination -->
< VueList
endpoint = "/api/users"
pagination-mode = "pagination"
>
<VueListPagination />
</ VueList >
<!-- Load more mode -->
< VueList
endpoint = "/api/posts"
pagination-mode = "loadMore"
>
<VueListLoadMore />
</ VueList >
Events
@onItemSelect
(newSelection: array, oldSelection: array) => void
Emitted when the selection changes. < VueList
endpoint = "/api/users"
@ on-item-select = " ( newSel , oldSel ) => {
console . log ( 'Selected:' , newSel )
} "
>
<!-- ... -->
</ VueList >
@onResponse
(response: object) => void
Emitted when a response is received from the API, before items are set. < VueList
endpoint = "/api/users"
@ on-response = " ( response ) => {
console . log ( 'Received:' , response )
} "
>
<!-- ... -->
</ VueList >
@afterPageChange
(response: object) => void
Emitted after a page change in pagination mode (not in loadMore mode). < VueList
endpoint = "/api/users"
@ after-page-change = " ( response ) => {
console . log ( 'Page changed:' , response )
} "
>
<!-- ... -->
</ VueList >
@afterLoadMore
(response: object) => void
Emitted after loading more items in loadMore mode. < VueList
endpoint = "/api/posts"
pagination-mode = "loadMore"
@ after-load-more = " ( response ) => {
console . log ( 'Loaded more:' , response )
} "
>
<!-- ... -->
</ VueList >
Slot Props
The default slot receives a scope object with all the list state and methods:
< VueList endpoint = "/api/users" v-slot = " { items , count , isLoading , refresh } " >
<div>
<p>Total: {{ count }}</p>
<p v-if="isLoading">Loading...</p>
<div v-for="item in items" :key="item.id">
{{ item.name }}
</div>
<button @click="refresh">Refresh</button>
</div>
</ VueList >
Show Available Slot Props
Full response object from the API
Whether data is currently being fetched
Whether this is the initial load
Error object if request failed
Processed attributes with labels
Whether the items array is empty
Function to refresh the list data
Exposed Methods
The component exposes methods via template refs:
< script setup >
import { ref } from 'vue'
const listRef = ref ()
function goToPage3 () {
listRef . value . setPage ( 3 )
}
function refreshList () {
listRef . value . refresh ()
}
</ script >
< template >
< VueList ref = "listRef" endpoint = "/api/users" >
<!-- ... -->
</ VueList >
</ template >
Show Exposed Methods and State
Reactive reference to items array
Reactive reference to API response
Reactive reference to loading state
Reactive reference to error state
Reactive reference to total count
Reactive reference to selection
Navigate to a specific page
setPerPage
(perPage: number) => void
Change items per page
setSort
({ by: string, order: string }) => void
Change sort configuration
refresh
(context?: object) => void
Refresh the current page data
Load more items (only in loadMore mode)