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

55 lines
1016 B
Vue
Raw Normal View History

<template>
2020-01-14 21:01:24 +00:00
<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 21:01:24 +00:00
import { mapGetters, mapActions } from 'vuex'
2020-01-14 21:01:24 +00:00
export default {
name: 'SearchBar',
props: {},
data() {
return {
user: null
}
2020-01-14 21:01:24 +00:00
},
created() {
this.getAllUsers()
},
methods: {
...mapActions({
getAllUsers: 'barUsers/getAllUsers',
addCreditList: 'barUsers/addCreditList'
}),
addUser() {
this.addCreditList(this.user)
this.user = null
}
},
computed: {
...mapGetters({ allUsers: 'barUsers/allUsers' })
}
}
</script>
<style scoped>
</style>