Dropdown drop-down menu of element-ui, passing multiple parameters

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:

  1. 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>

  2. Combine several parameters into one:
    For example:

     beforeHandleCommand(v1,v2.v3) {
          
          
     	return {
          
          
     		id:v1,
     		msg: v2,
     		like: v3
     	}
    }
    
  3. Everything else is the same as before

    <el-dropdown  trigger="click"  @command="handleStatusCommand">
    
    handleStatusCommand(command) {
          
          
      console.log(command);
    }
    
  4. 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:
insert image description here
Red - nothing changes, what should or what
Blue - becomes a method
insert image description here

Guess you like

Origin blog.csdn.net/weixin_42947972/article/details/128237170