mirror of
https://github.com/tenrok/vue-select.git
synced 2026-06-10 07:52:23 +03:00
add ajax to docs
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<template>
|
||||
<pre><v-code lang="markup"><v-select
|
||||
:debounce="250"
|
||||
:on-search="getOptions"
|
||||
:options="options"
|
||||
placeholder="Search GitHub Repositories..."
|
||||
label="full_name"
|
||||
>
|
||||
</v-select></v-code></pre>
|
||||
<pre><v-code lang="javascript">data() {
|
||||
return {
|
||||
options: null
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getOptions(search, loading) {
|
||||
loading(true)
|
||||
this.$http.get('https://api.github.com/search/repositories', {
|
||||
q: search
|
||||
}).then(resp => {
|
||||
this.options = resp.data.items
|
||||
loading(false)
|
||||
})
|
||||
}
|
||||
}
|
||||
</v-code></pre>
|
||||
</template>
|
||||
|
||||
<script type="text/babel">
|
||||
export default {}
|
||||
</script>
|
||||
Reference in New Issue
Block a user