vue elementui type=expand 设置只可以展开一行、设置点击行即可打开扩展内容

1、设置只可以展开一行

table里面事件添加

<el-table class="elTable" ref="machineTable"   :data="machineDataList" 
:row-key="(row) => { return row.id }"
@expand-change="handleExpandChange"
@row-click="handledetail11">

method:

复制代码
                handleExpandChange(row,rows){
                    var that = this
                    if (rows.length>1) {
                        that.expands = []
                        if (row) {
                            that.expands.push(row);
                        }
                        this.$refs.machineTable.toggleRowExpansion(rows[0]);
                    } else {
                        that.expands = [];
                    }
                }
复制代码

data:

expands:[]

 2、设置点击行即可打开扩展内容

handledetail11(row, column, event) {
                    this.$refs.machineTable.toggleRowExpansion(row)
                },

3、隐藏表格扩展隐藏图标

<el-table-column type="expand" width="1" >

 

 

 

 



 

posted @   凉面好好吃  阅读(3025)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!
历史上的今天:
2020-12-09 SQL 清除数据库日志
点击右上角即可分享
微信分享提示