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;
    },
相关推荐
_xaboy7 小时前
低代码可视化表单设计器 FcDesigner 远程请求教程:GET POST 变量鉴权
低代码·开源·vue·表单·fcdesigner
m0_5791466514 小时前
Element UI 表格合并单元格完全指南:从原理到实战
前端·vue.js·elementui
常宇佳3 天前
vue3 实战系列之踩过的一些坑
javascript·vue.js·elementui
宠友信息3 天前
IM系统开发技术路线分析,即时通讯源码助力快速搭建聊天应用
java·spring boot·redis·websocket·mysql·uni-app·vue
南城以南溫暖如初1475 天前
从传统健身房到无人值守:24小时自助健身系统的技术实现路径
java·spring boot·mysql·架构·vue
新中地GIS开发老师5 天前
WebGIS开发学生作品 | 基于无人机影像的烟草检测智能体与数字化管理平台
vue·web·mapbox·webgis
南城以南溫暖如初1475 天前
外卖CPS实战指南:从技术选型到运营落地全流程解析
java·spring boot·mysql·架构·vue
aXin_ya5 天前
ElementUI (01):Vue2 项目引入 ElementUI使用
elementui·vue
山川志~6 天前
Vue + Element UI 实战:如何实现表格时间、金额字段排序
vue.js·ui·elementui
常宇佳6 天前
vue3 @代指src路径设置
前端·typescript·vue