其他分享
首页 > 其他分享> > elementui二维表动态渲染

elementui二维表动态渲染

作者:互联网

elementUI如何动态渲染二维表,动态渲染表格的列,例如下图:

 

 

代码:

<div id="app">
    <template>
        <el-table :data="tableData" style="width: 100%">
            <el-table-column prop="name" label="日期" width="180">
            </el-table-column>
            <el-table-column v-for="(item,index) in zhibiao" :label="item" width="180">
                <el-table-column v-for="i in time" :label="i" align="center" header-align="center">
                    <template slot-scope="scope">{{scope.row[i][index]}}</template>
                </el-table-column>
            </el-table-column>
        </el-table>
    </template>
</div

  

data() {
    return {
        zhibiao: ['指标1', '指标2', '指标3',],
        time: ['201906', '201907', '201908',],
        tableData: [{
            name: '企业1',
            201906: ['1', '1', '1',],
            201907: ['2', '2', '2',],
            201908: ['3', '3', '3',],
        }, {
            name: '企21',
            201906: ['4', '4+', '13.',],
            201907: ['7897', '6', '5',],
            201908: ['78', '456', '456',],
        }]
    }
}

  文章来源:https://blog.csdn.net/qq_38693333/article/details/119670693

标签:name,渲染,elementui,456,201906,201907,二维,201908
来源: https://www.cnblogs.com/wofeiliangren/p/16668962.html