0%

element-UI dropdown 传多个参数

element-UI dropdown 在表格里,需要传多个参数

html 代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<el-table-column fixed="right" label="操作">
<template slot-scope="scope">
<el-dropdown trigger="click" size="small" @command="handleCommand">
<span class="el-dropdown-link">更多</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand('add',scope.row)">
审批
</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand('info',scope.row)">
审批记录
</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
js 代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
beforeHandleCommand(item, row) {
return {
command: item,
row: row
};
},

handleCommand(command) {
console.log(command);
if (command.command === "add") {
this.addSubAgency(command.row);
} else if (command.command === "info") {
this.querySubAgencyApproveInfo(command.row);
}
}