el-table type="expand" 子项无数据时不显示展开按钮

el-table type=
父级表格设置属性 :row-class-name="getRowClass"

<el-table
	:data="tableData"
	:row-class-name="getRowClass">
	<el-table-column type="expand">
		<template slot-scope="props">
		...
		template>
	el-table-column>
	...
el-table>
// 判断表格是否有子项,无子项不显示展开按钮
getRowClass (row, rowIndex) {
	// children 是你子项的数组 key
	if (row.row.children.length === 0) {
		return 'row-expand-cover'
	}
}
/deep/ .el-table .row-expand-cover .cell .el-table__expand-icon {
	display: none;
}

转载文章: https://www.cnblogs.com/smile-fanyin/p/12493512.html

你可能感兴趣的:(Element,UI)