【发布时间】:2020-12-11 09:56:18
【问题描述】:
我正在尝试显示从 firestore 获取的数据,并希望使用 Vue.js 和 Element UI 将其显示在表格上。我已经尝试寻找解决方案,但大多数显示固定数量的数据,而对于我的情况,我的数据数量不均匀。
我的数据结构如下:
suppData: [{
comp_name: "company 1",
country: "country 1",
contInfo: [{
cpName: "John Doe",
phone: "123123",
email: "john@doe.com
},
prodList: [{
product: "eggs",
product: "shoes"
}
}],
comp_name: "company 2",
country: "country 2",
contInfo: [{
cpName: "Jack Doe",
phone: "1231231",
email: "jack@doe.com
},
{
cpName: "Michelle",
phone: "12412",
email: "mmichelle@doe.com
},
prodList: [{
product: "eggs",
}
}]
}]
我现在用于表格的代码,使用了其他方法,例如格式化程序,展平数据,但无法使其工作,因此感谢您的帮助!
<el-table-column label="Company Name" prop="company_name"></el-table-column>
<el-table-column label="Country" prop="country"></el-table-column>
<el-table-column label="Contacs" prop="contactName.cpName"></el-table-column>
【问题讨论】:
-
可以使用 v-for 指令显示列表或数组,vuejs.org/v2/api/#v-for
标签: vue.js google-cloud-firestore frontend element-ui