element ui table某个单元格添加点击事件

1.创建表格

ref="multipleTable"

:data="tableData"

border

>

:prop="item.prop"

:label="item.label"

:formatter="item.formatter"

align="center"

show-overflow-tooltip

>

2.创建表头+事件 

element ui table某个单元格添加点击事件_第1张图片

 

columns: [

{

prop: "index",

label: "序号",

formatter: (row, column, cellValue, index) => {

return {index + 1};

}

},

{

prop: "userName",

label: "姓名"

},

{

prop: "roleName",

label: "角色名称"

},

{

prop: "topManagerUserVo",

label: "上级主管",

formatter: (row, column) => {

if (row.topManagerUserVo) {

return row.topManagerUserVo.roleName;

} else {

return "";

}

}

},

{

prop: "accountStatus",

label: "帐号状态",

formatter: (row, column) => {

if (row.accountStatus == 0) {

return "禁用";

}

if (row.accountStatus == 1) {

return "启用";

}

if (row.accountStatus == 2) {

return "已过期";

}

}

},

],

element ui table某个单元格添加点击事件_第2张图片 

 element ui table某个单元格添加点击事件_第3张图片

 

你可能感兴趣的:(el-table,elementui)