We've built an app with Vue.js and Firebase where jobs is a node in our db. When we add an event, we want to include the jobs available for that event. On our "Add Event" layout, I've included checkboxes of all the jobs in the DB. We want to be able to select the relevant jobs.
The way it is set up, it works great if you only check one job, but we often need to include 5-10 jobs.
How can I change the code so that I can select multiple jobs at once?
<v-list>
<v-list-tile v-for="job in jobs" :key="job.title">
<v-list-tile-content>
<v-checkbox :value="job.title" :key="job.title" :label="job.title" v-model="event.selectedJobs" ingle-line bottom return-object></v-checkbox>
</v-list-tile-content>
</v-list-tile>
</v-list>
...
export default {
data () {
return {
title: '',
description: '',
startDate: '',
endDate: '',
selectedJobs: [],
...
computed: {
jobs () {
return this.$store.getters.loadedJobs
}
},
... vuex:
loadedJobs(state) {
return state.loadedJobs
}
Aucun commentaire:
Enregistrer un commentaire