无法从Firebase动态将类别的子类别显示为v-list-title

时间:2019-07-06 10:32:43

标签: javascript firebase vue.js google-cloud-firestore vuetify.js

我正在尝试将类别及其子类别显示为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" },              
            ]

          });
        }
      });
    });

0 个答案:

没有答案