1、html代码如下:
<el-table> :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border default-expand-all :tree-props="{children: 'children', hasChildren: 'hasChildren'}"> <el-table-column prop="date" label="日期" sortable width="180"> </el-table-column> <el-table-column prop="name" label="姓名" sortable width="180"> </el-table-column> <el-table-column prop="address" label="地址"> </el-table-column> </el-table> //这里有2点需要注意: 1、row-key="id"; 2、:tree-props="{children: 'children', hasChildren: 'hasChildren'}"。
2、js代码:
export default {
data() {
return {
tableData: [{
id: 1,
date: '2016-05-02',
name: '王小虎',
address: '上海市普陀区金沙江路 1518 弄'
}, {
id: 2,
date: '2016-05-04',
name: '王小虎',
address: '上海市普陀区金沙江路 1517 弄'
}, {
id: 3,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄',
children: [{
id: 31,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}, {
id: 32,
date: '2016-05-01',
name: '王小虎',
address: '上海市普陀区金沙江路 1519 弄'
}]
}]
}
}
}
//注意children里面的id
总结:
1、el-table属性 row-key 一定要写。
2、如果children和hasChildren不是默认则需要指定 :tree-props=”{children:’children’, hasChildren:’hasChildren’}”
3、lazy为false时,数据不能包含hasChildren字段
el-table利用:row-style="rowClass"设置指定行变色
el-table表格显示selection多选时对某些复选框设置禁止选中
el-table表格实现多选功能(全选/指定选中/取消选中)
上面是“el-table通过tree-props实现表格嵌套表格”的全面内容,想了解更多关于 vuejs 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_1752.html
workflows工作流
Latent放大comfyui工作流
一张科幻照片,火星车在沙漠里ComfyUI工作流
一只可爱的小鸟在飞翔ComfyUI工作流
一群蚂蚁在路上忙碌着ComfyUI工作流
一只千纸鹤坐在路上哭泣ComfyUI工作流
小鸟在黑暗的天空中优雅地跳舞
完整海报生成comfyui工作流
一座巨大的野兽派建筑漂浮在热带风景中的贫民
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

用canvas实现画板涂鸦效果
js导出excel插件(兼容mac电脑Numbers表格)
做一个好玩的时钟翻牌效果
3D彩色卡片
css3搭积木叠加图形
纯css翻书效果
黑客入侵效果代码











