我正在尝试将类别及其子类别显示为v-list-tile。从Firebase提取数据。类别显示完美,但无法动态显示子类别。
这是完整的代码 https://codeshare.io/5OmpWN
created() {
// Show All Expense
let ref = db.collection("item_categories");
ref.onSnapshot(snapshot => {
snapshot.docChanges().forEach(change => {
if (change.type == "added") {
let doc = change.doc;
this.items.push({
icon: "keyboard_arrow_up",
"icon-alt": "add_shopping_cart",
text: doc.data().category_name,
model: false,
children:[
{ text: "Sub Category 1" },
{ text: "Sub Category 2" },
]
});
}
});
});