我正在構(gòu)建一個 Vue.js 應(yīng)用程序,它使用戶能夠?qū)㈨椖刻砑拥揭言?Firebase 文檔中設(shè)置的數(shù)組中。將項目添加到數(shù)據(jù)庫中的數(shù)組的函數(shù)工作正常。我想將數(shù)組中的項目作為屏幕上的列表項目返回。然而,目前整個數(shù)組容器返回到屏幕。如何重新設(shè)置樣式,以便數(shù)組項在沒有容器的情況下很好地呈現(xiàn)為列表項?最好使用 Vuetify。謝謝!模板<v-list class="elevation-1"> <v-list-tile-content v-for="user in this.$store.getters.getUsers" :key="user.id" > <v-list-tile> {{ user.events }} </v-list-tile> </v-list-tile-content></v-list>方法 async addInput () { let finalInput = this.newInput let ref = await db.collection('users').where('user_id', '==', firebase.auth().currentUser.uid) .get() .then(function(querySnapshot) { querySnapshot.forEach(function(doc) { console.log(doc.id, " => ", doc.data()); doc.ref.update({'events': firebase.firestore.FieldValue.arrayUnion(finalInput)}) }) }) .catch(function(error) { console.log("Error getting documents: ", error); }); }
如何在 Vue.js 中顯示 Firebase 數(shù)組項
慕勒3428872
2021-10-07 10:34:01