Migracia a male opravy
- csrf ocharana, vypnutie pre /log - oprava loggovania pamate - pridanie vue skriptov
This commit is contained in:
45
resources/js/components/SearchInput.vue
Executable file
45
resources/js/components/SearchInput.vue
Executable file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<vue-suggestion :items="items"
|
||||
v-model="item"
|
||||
:setLabel="setLabel"
|
||||
:itemTemplate="itemTemplate"
|
||||
@changed="inputChange"
|
||||
@selected="itemSelected">
|
||||
</vue-suggestion>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import itemTemplate from './item-template.vue';
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
item: {},
|
||||
items: [
|
||||
|
||||
],
|
||||
itemTemplate,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
itemSelected (item) {
|
||||
this.item = item;
|
||||
},
|
||||
setLabel (item) {
|
||||
return item.computer;
|
||||
},
|
||||
inputChange (text) {
|
||||
axios.get('search/autocomplete', {
|
||||
params: {
|
||||
term: text,
|
||||
}
|
||||
})
|
||||
.then((response) => {
|
||||
this.items = response.data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
Reference in New Issue
Block a user