Vue and Element Component
230 观看
1回复
9200 作者的声誉
I have a complex object, for brevity the object is structured in this manner:
{
Sample: [{
Model: {
Id: "1"
},
Collection: [{
Id: "1"
}]
}]
}
The data table renders the model data fine. But, when trying to access the collection, the table doesn't output the data.
<template>
<el-table :data="Sample" highlight-current-row :row-class-name="tableRow" stripe :default-sort="{ prop: 'Sample.Id, order: 'descending'}">
<el-table-column type="expand">
<el-row :gutter="20" v-for="property in Collection">
<el-col :span="24"><div>Id: {{ property.Id }}</div></el-col>
</el-row>
</el-table-column>
<el-table-column prop="Model.Id" label="Id" width="300"></el-table-column>
</el-table>
</template>
Does the data being binded to the table ignore the loop? I'm able to access during the binding as a prop, the data is being sent over, but when the loop is added, the data doesn't output.
作者: Greg 的来源 发布者: 2017 年 12 月 27 日回应 1
1像
26 作者的声誉
I know why the loop is not work, because Collection
is in the Sample
. Your data structure is a Sample
array, it contains an object.
So, you can fix the code to this:
v-for="(property,index) in Sample[0].Collection"
来自类别的问题 :
- vue.js vue.js表单验证和ajax提交
- vue.js 对应于vue.js组件的DOM元素
- vue.js [Vue警告]:找不到元素
- vue.js vuejs:尝试使用v-el指令集中输入
- vue.js Vue显示未转义的HTML
- vuejs2 Vue.js重定向到另一个页面
- vuejs2 VueJS组件
- vuejs2 VueJs 2.0中兄弟组件之间的通信
- vuejs2 Vue 2 - 变异道具vue-warn
- vuejs2 如何在VueJS中的组件之间共享数据
- element 从C#中的List <T>中选择N个随机元素
- element 检查数组是否是多维的?
- element 我如何引用加载当前正在执行的脚本的脚本标记?
- element 从数组中删除元素(Java)
- element 将图标放入表单中的输入元素
- element-io Vue and Element Component
- element-io 如何在单个元素中连接日期选择器值和时间选择器值?