Я пытаюсь создать массив ссылок с помощью Vue.js + Firebase.В SELECT INPUT с использованием множественного числа, когда я пытаюсь сохранить, это (очевидно) создает массив, поэтому моя ссылка не работает.Я понял почему, но я не знаю, как это решить.Когда OPTIONS из SELECT входит в поле для перехода в Firebase, он захватывает и Array, поэтому моя ссылочная ссылка выглядит как 'todos / Item1, Item2, Item3' ... Извините, если это вопрос новичка, но я только начал сvue.js и firebase.Благодарю.
HTML:
<form class="new-todo-form">
<label class="new-todo-label">
Day and Hour
<input v-model="date" type="date" class="new-todo-input"/>
</label>
<label class="new-todo-label">
Participantes:
<select v-model="participants" class="select-input" multiple>
<option v-for="todo in todos" v-bind:value="todo.institution">{{todo.institution}}</option>
</select>
</label>
<button type="submit" @click.prevent="addTest()" class="new-todo-button">Add</button>
</form>
addTest() {
testsCollection.doc(this.date).set({
id: this.tests.length,
date: this.date,
participants: todosCollection.doc('todos/' + this.participants),
})
.then(function(docRef) {
console.log("Document written with ID: ", docRef.id);
})
.catch(function(error) {
console.error("Error adding document: ", error);
});
},
Ошибка в консоли:
[Vue warn]: Error in v-on handler: "FirebaseError: [code=invalid-argument]: Function CollectionReference.doc() requires its first argument to be of type non-empty string, but it was: an array"
found in
---> <App> at src/App.vue
<Root> vue.esm.js:628
FirebaseError: "Function CollectionReference.doc() requires its first argument to be of type non-empty string, but it was: an array"
FirestoreError index.cjs.js:352
validateType index.cjs.js:673
validateArgType index.cjs.js:574
doc index.cjs.js:21267
addTeste App.vue:481
click App.vue:386
VueJS 3