也许是很久没用这个库了 今天找这个问题还花了一会儿时间 也是蛮简单的一个问题 排查过程就不说了 直接说结果吧 记录一下
发现问题 展开第一列的时候表格没问题 收起的时候 莫名其妙多了一个展开的按钮
代码咋一看没什么问题 百思不解不得其解 甚至怀疑row-key的问题 检查了数据 expand-change也检查了逻辑 没什么问题
<el-table
ref="tableRef"
:data="tableData"
style="width: 100%"
row-key="sectorCode"
border
:height="tableHeight"
show-summary
:summary-method="getSummaries"
@expand-change="handleExpandChange"
>
<el-table-column type="expand">
<template #default="props">
<el-table
:data="props.row.children"
style="width: 100%"
size="small"
border
:show-header="false"
>
<!-- 二级表格占位空白列,宽度和一级展开列一致 -->
<el-table-column width="48px" />
<!-- 二级表格序号列 -->
<el-table-column width="50" />
<el-table-column prop="sector" label="板块">
<template slot-scope="scope">
<el-link type="primary" @click="checkDetails(scope.row)">{{
scope.row.sector
}}</el-link>
</template>
</el-table-column>
</el-table>
</template>
</el-table-column>
<!-- 一级表格序号列,放在展开列后面 -->
<el-table-column type="index" width="50" label="序号" />
<el-table-column prop="sector" label="板块">
<template slot-scope="scope">
<el-link type="primary" @click="checkDetails(scope.row)">{{
scope.row.sector
}}</el-link>
</template>
</el-table-column>
</el-table>
后来感觉像是占用到树形表格的关键字的问题 于是 把嵌套表格中的 :data="props.row.children" 属性改为 :data="props.row.ItemTableData" 问题解决 shit!!!
确实是小问题,但是花了时间,所以记录一下!