element-ui Dropdown 传多个参数

使用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;
    }
}
上一篇:JVM深入学习笔记一:Java 编译器初探


下一篇:插值查找算法