flaschengeist-frontend/src/components/baruser/SearchBar.vue

51 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<div>
<v-toolbar>
<v-spacer/>
<v-toolbar-items>
<v-autocomplete outlined return-object v-model="user" style="margin-top: 3px"
placeholder="Suche Person" :items="allUsers" item-text="fullName"
prepend-inner-icon="search" full-width/>
<v-btn text @click="addUser">Hinzufügen</v-btn>
</v-toolbar-items>
</v-toolbar>
</div>
</template>
<script>
2020-01-14 18:57:45 +00:00
import { mapGetters, mapActions } from 'vuex';
export default {
name: "SearchBar",
props: {
},
data () {
return {
2020-01-14 18:57:45 +00:00
user: null,
}
},
created() {
2020-01-14 18:57:45 +00:00
this.getAllUsers()
},
methods : {
2020-01-14 18:57:45 +00:00
...mapActions({
getAllUsers: 'barUsers/getAllUsers',
addCreditList: 'barUsers/addCreditList'
}),
addUser() {
2020-01-14 18:57:45 +00:00
this.addCreditList(this.user)
this.user = null
}
},
computed: {
2020-01-14 18:57:45 +00:00
...mapGetters({ allUsers: 'barUsers/allUsers'}),
}
}
</script>
<style scoped>
</style>