2
0
mirror of https://github.com/tenrok/vue-select.git synced 2026-05-17 02:29:37 +03:00
Files
vue-select/docs/md/Ajax.md
T
Jeff Sagal 201e135964 - new dedicated development template
- separate environment for developing docs
- clear out discarded couscous files
- start converting docs markdown
2017-02-01 22:32:06 -08:00

1.4 KiB

AJAX Remote Option Loading

The onSearch prop allows you to load options via ajax in a parent component when the search text is updated. It is invoked with two parameters, search & loading.

onSearch Callback Parameters search, loading

search is a string containing the current search text. loading is a function that accepts a boolean value, and is used to toggle the 'loading' class on the top-level vue-select wrapper.

Loading Spinner

Vue Select includes a default loading spinner that appears when the loading class is present. The spinner slot allows you to implement your own spinner.

Toggle Spinner
Loading...

Debounce Input

Vue Select also accepts a debounce prop that can be used to prevent onSearch from being called until input has completed.

Library Agnostic

Since Vue.js does not ship with ajax functionality as part of the core library, it's up to you to process the ajax requests in your parent component.

Example GitHub API

In this example, Vue Resource is used to access the GitHub API.