我在/buildings.vue组件的顶部导入了一个火力基地:
...
import buildingsadd, { buildingsRef } from './buildingsadd.vue';
export default {
firebase() {
return {
buildings: buildingsRef
}
},
components: {
buildingsadd
},
name: 'buildings',
...
在/buildingsadd.vue组件上,我定义了一条到 firebase ref 的新路径,如下所示:
...
import firebase from '../firebase-config';
import { db } from '../firebase-config';
export default {
firebase() {
return {
buildings: buildingsRef,
users: usersRef,
}
},
name: 'buildingsadd',
data () {
return {
newBuilding: {
name: '',
}
}
},
methods: {
addBuilding: function () {
let userId = firebase.auth().currentUser.uid;
let buildingsRef = db.ref('buildings/'+userId);
}
...
但是我收到了这个错误:
对此的答案也将解决我的特定问题: