这是我在App.vue中创建的挂钩中调用的Vuex模块和bindTechnology操作:
import {firebaseAction} from "vuexfire";
import { db } from '@/Services/Firebase';
const state = {
dashboards: [],
technology: []
};
const getters = {
dashboards: state => state.dashboards,
technology: state => state.technology
};
const mutations = {};
const actions = {
bindDashboards: firebaseAction(({ bindFirebaseRef }) => {
return bindFirebaseRef('dashboards', db.ref('dashboards'));
}),
bindTechnology: firebaseAction(({ bindFirebaseRef }) => {
return bindFirebaseRef('technology', db.ref('dashboards/technology'));
})
};
这是我的FB RTDB技术结构
technology
green: 0.5
projects:
+ Beacon
+ FleetManager
+ Dashboards
rate: 0.3899
yellow: 0.35
我的吸气剂-技术-返回此:
technology: Array[4]
+ 0: Object (empty)
+ 1: Object
+ Beacon
+ FleetManager
+ Dashboards
+ 2: Object (empty)
+ 3: Object (empty)
我无法弄清空对象的来源,也无法弄清楚如何显示数据,因为技术数组由FB按字母顺序排列,并且添加更多数据时下标(当前为1)会更改。
欢迎提出任何建议。