I am facing an issue with the undefined value in the select view while attempting to add a new project. Could you suggest a solution? I tried using v-if but it didn't work for me.
This is how my code looks:
<v-select
v-model="project.kierownik_id"
:items="formattedUsers"
:item-props="itemProps"
item-text="_id"
item-value="_id"
label="kierownik:"
track-by="project.kierownik_id"
></v-select>
addProject() {
console.log(' (before let paylod) Adding project:', this.project);
let payload = { ...this.project, kierownik_id: this.project.kierownik_id, };
axios
.post('/project', payload)
.then((res) => {
console.log('Adding project:', this.project);
this.$emit('hideEditProject', res.data);
})
.catch((err) => {
this.error.message = err.response.data.message + ': ' + err.response.data.error;
this.error.show = true;
});
},
data() {
return {
project: {
kierownik_id: null,
},
dataCorrect: true,
users: {},
error: { show: false, message: '' },
confirmDelete: false
}
},
I would like to eliminate the undefined value in the select view when adding a new project. Image