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;
    },
相关推荐
软件2058 小时前
【vue3主题切换】
vue
拼图2099 小时前
element-plus——图标推荐
javascript·vue.js·elementui
结衣结衣.15 小时前
Vue3入门-计算属性+监听器
前端·javascript·vue.js·vue·js
伍哥的传说1 天前
Webpack5 新特性与详细配置指南
webpack·前端框架·vue·vue3·react·webpack5·前端构建
军军君013 天前
基于Springboot+UniApp+Ai实现模拟面试小工具三:后端项目基础框架搭建上
前端·vue.js·spring boot·面试·elementui·微信小程序·uni-app
你这-坏孩子3 天前
更改elementui 图标 css content
前端·css·elementui
xaboy3 天前
Vue 开源项目低代码表单设计器 FcDesigner v3.3 版本发布!兼容Element Plus/Ant Design/Vant,支持PC/移动端
低代码·vue·表单设计器
程序猿小D3 天前
[附源码+数据库+毕业论文]基于Spring+MyBatis+MySQL+Maven+vue实现的酒店预订管理系统,推荐!
数据库·mysql·spring·vue·毕业设计·mybatis·酒店预订
马卡龙MK3 天前
vue 不完美的多标签页解决方案
vue
goms3 天前
前端项目集成lint-staged
前端·vue·lint-staged