Dropdown drop-down menu of element-ui, passing multiple parameters
Reason: The Dropdown drop-down menu only allows us to pass one parameter
to solve the steps:
-
where the method is called early where we are allowed to pass an argument:
before:<el-dropdown-item command="a"> 测试 </el-dropdown-item>
now:<el-dropdown-item :command="beforeHandleCommand('a','b','c')">测试</el-dropdown-item>
-
Combine several parameters into one:
For example:beforeHandleCommand(v1,v2.v3) { return { id:v1, msg: v2, like: v3 } }
-
Everything else is the same as before
<el-dropdown trigger="click" @command="handleStatusCommand">
handleStatusCommand(command) { console.log(command); }
-
It is only necessary to get the corresponding data. The corresponding definition will do.
handleStatusCommand(command) { console.log(command.id,command.msg,command.like); }
Complete example:
Red - nothing changes, what should or what
Blue - becomes a method