如图, element ui table组件给的合并表头是类似这种的,只有上方的表头可以合并。我想知道如果需要左侧也需要合并(如下图)改如何修改呢?请各位赐教。
如图, element ui table组件给的合并表头是类似这种的,只有上方的表头可以合并。我想知道如果需要左侧也需要合并(如下图)改如何修改呢?请各位赐教。
最新的提供了合并样式element,
<el-table :data="tableData2" border style="width: 100%">
<el-table-column width='400' label="产出要素性质">
<template scope="scope">
<p v-show="scope.row.show">{{scope.row.nature}}</p><el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-show="!scope.row.show" v-model="scope.row.nature"></el-input>
</template>
</el-table-column>
<el-table-column label="具体产出">
<template scope="scope">
<div class="content-rowspan">
<div v-for="(list,index) in scope.row.lists"><p v-show="scope.row.show">{{list}}<el-button class="delelist" type="danger" size="small" @click="delelist(tableData2,scope.$index,index)">删除</el-button></p><el-input type="textarea" :autosize="{ minRows: 2, maxRows: 4}" v-show="!scope.row.show" v-model="scope.row.lists[index]"></el-input></div>
<div><el-button size="small" type="primary" icon="plus" @click="addlist(tableData2,scope.$index)"></el-button></div>
</div>
</template>
</el-table-column>
<el-table-column width='200' label="操作">
<template scope="scope">
<el-button @click.native.prevent="deleteRow(scope.$index,tableData2)" type="danger" size="small">
删除
</el-button>
<el-button @click.native.prevent="editRow(scope.$index,tableData2)" type="primary" size="small">
编辑
</el-button>
<el-button @click.native.prevent="keep(scope.$index,tableData2,2)" type="success" size="small">
保存
</el-button>
</template>
</el-table-column>
</el-table>
5 回答1.4k 阅读✓ 已解决
2 回答1.2k 阅读✓ 已解决
2 回答886 阅读✓ 已解决
1 回答754 阅读✓ 已解决
1 回答726 阅读✓ 已解决
3 回答916 阅读
2 回答937 阅读
我使用的elementUI版本是2.3.2,查看文档,使用表格的 header-cell-style 属性,通过传参使用 css display 控制你需要隐藏或者显示的表格即可,用我的代码举例,我需要实现的效果是这样的

代码构造如下
上面的hide1、hide2、hide3是我用来形成表格布局的,往 header-cell-style 属性传入以下函数
即可实现所需效果

类似需求我认为基本可以用这种方法实现。