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;
    },
相关推荐
铅笔侠_小龙虾18 小时前
Ubuntu 搭建前端环境&Vue实战
linux·前端·ubuntu·vue
冥界摄政王19 小时前
Cesium学习第一章 安装下载 基于vue3引入Cesium项目开发
vue·vue3·html5·webgl·cesium
IT教程资源D21 小时前
[N_093]基于springboot,vue的宠物商城
mysql·vue·前后端分离·宠物商城·springboot宠物商城
IT教程资源C21 小时前
(N_093)基于springboot,vue的宠物商城
mysql·vue·前后端分离·宠物商城·springboot宠物商城
Irene19912 天前
实用篇:vsCode 中连接 WSL 并快速开始一个 Vue3 新项目
git·vscode·vue·wsl
丸子哥哥2 天前
vue + uni-app:利用原生uni.chooseImage封装拍照功能的组件
微信小程序·uni-app·vue
天天向上vir2 天前
防抖与节流
前端·typescript·vue
@AfeiyuO2 天前
Vue3 饼图定制图
vue·echarts
千寻技术帮2 天前
10422_基于Springboot的教务管理系统
java·spring boot·后端·vue·教务管理
是梦终空2 天前
计算机毕业设计260—基于Springboot+Vue3+Ai对话的非遗传承管理系统(源代码+数据库+2万字论文)
spring boot·vue·毕业设计·课程设计·毕业论文·ai对话·非遗传承管理系统