(一)一个数组构成的表格(数据:每个数组项有1个子数组)
需求:
效果:
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/80ff20c845306db2bd9db25d3e5b2637.png)
原数据和处理后数据
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/d71f0970da1a41b64e0fb1919fe8d5bd.png)
代码:(包括模拟数据的生成和数据处理)
<el-table v-loading="loading" :data="listData" :span-method="objectSpanMethod">
<el-table-column prop="getOddNumbers" label="领用单号" width="20"></el-table-column>
<el-table-column prop="assetsCoding" label="资产编码" width="200"></el-table-column>
</el-table>
data() {
return {
loading: false,
listData: [],
```js
getList(){
this.loading = true;
this.listData = [];
let colNums = [2,2,1,3,3]
let resData = [];
for(var i=0; i<5; i++){
let form = {
}
form.id = i;
form.getOddNumbers = '领用单号'+i;
let temp = [];
let len = colNums[i]
for(let j=0; j<len; j++){
let tempItem = {
};
tempItem.assetsCoding = '资产编码'+i+j;
temp.push(tempItem);
}
form.assets