使用Dropdown 下拉菜单操作需要传入id
<el-dropdown
type="primary"
size="mini"
@command="handleCommand">
操作
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand('a',id)">编辑</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand('b',id)">删除</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
beforeHandleCommand(item,id){
return {
'command': item,
'id': id
}
},
handleCommand(command){
switch (command.command) {
case "a":
this.edit(command.id)
break;
case "b":
this.del(command.id)
break;
}
}