el-dropdown的command方法添加自定义参数

代码

javascript 复制代码
<div v-for="(item, index) in queryParams.changeParams" :key="index">
        <el-form-item prop="dataConditionSearch">
          <el-dropdown @command="handleCommand" style="margin-right: 3px;">
            <span class="el-dropdown-link" style="cursor: pointer;">
              {{queryParams.changeParams[index].dataCondition}}<i class="el-icon-arrow-down el-icon--right"></i>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item :command="beforeHandleCommand('大于', index)">大于</el-dropdown-item>
              <el-dropdown-item :command="beforeHandleCommand('小于', index)">小于</el-dropdown-item>
              <el-dropdown-item :command="beforeHandleCommand('等于', index)">等于</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <el-input v-model="queryParams.changeParams[index].dataConditionSearch" placeholder="请输入" clearable style="width: 130px;" />
        </el-form-item>
        <el-form-item label-width="10px">
          <i class="el-icon-remove-outline" style="cursor: pointer;" @click.prevent="deleteChangeParams(item)" />
        </el-form-item>
      </div>

使用:command

javascript 复制代码
    beforeHandleCommand(command, index) {
      return {
        'command': command,
        'index': index
      }
    },
    handleCommand(command) {
      let condition = command.command;
      let index = command.index;
      this.queryParams.changeParams[index].dataCondition = condition;
    },
相关推荐
天高任鸟飞dyz11 小时前
tabs切换#
javascript·vue.js·elementui
菜鸟una11 小时前
【layout组件 与 路由镶嵌】vue3 后台管理系统
前端·vue.js·elementui·typescript
数字游名Tomda17 小时前
我开源了一个免费在线工具!UIED Tools
开源·vue·在线工具
像鱼一样沦陷在代码大海1 天前
vue 中的ref
vue
m0_627827521 天前
vue3中 input 中放大镜在后面
javascript·vue.js·elementui
滿3 天前
Vue3 + Element Plus 动态表单实现
javascript·vue.js·elementui
MaCa .BaKa3 天前
37-智慧医疗服务平台(在线接诊/问诊)
java·vue.js·spring boot·tomcat·vue·maven
ドロロ8063 天前
element-plus点击重置表单,却没有进行重置操作
javascript·vue.js·elementui
是梦终空3 天前
Python毕业设计219—基于python+Django+vue的房屋租赁系统(源代码+数据库+万字论文)
python·django·vue·毕业设计·毕业论文·源代码·房屋租赁系统
緑水長流*z4 天前
(14)Element Plus项目综合案例
vue.js·elementui·vue3·element plus·elementplus项目·完整项目案例·项目学习笔记