vue利用v-for嵌套输出多层对象,分别输出到个表的方法
时间:2021-12-28 10:42:52|栏目:vue|点击: 次
如下所示:
specifications:[
{
specificationName:"颜色",
specificationItem:[
{value:"黄色"},
{value:"黑色"}
]
}
]
<table class="table table-bordered table-hover table-item spggdytable"
id="ggxtable" v-show="isAddSpecifications">
<thead>
<tr>
<th>排序</th>
<th>规格项</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<tr v-for="(item,index) in specifications">
<td>{{index}}</td>
<td>{{item.specificationName}}</td>
<td>
<a href='#'> <img src='../img/common_edit@25.png' alt='修改'></a>
<a href='#'><img src='../img/common_del@25.png' alt='删除'></a>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered table-hover table-item spggdytable"
id="ggztable" v-show="isAddSpecifications">
<thead>
<tr>
<th>规格值</th>
<th>操作</th>
</tr>
</thead>
<tbody v-for="(item,index) in specifications">
<tr v-for="(part,n) in item.specificationItem">
<td>{{part.value}}</td>
<td>
<a href='#'> <img src='../img/common_edit@25.png' alt='修改'></a>
<a href='#'><img src='../img/common_del@25.png' alt='删除'></a>
</td>
</tr>
</tbody>
</table>

上一篇:基于element-ui封装表单金额输入框的方法示例
栏 目:vue
下一篇:Vue 如何使用props、emit实现自定义双向绑定的实现
本文标题:vue利用v-for嵌套输出多层对象,分别输出到个表的方法
本文地址:http://www.codeinn.net/misctech/188304.html






