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;
    },
相关推荐
jay神2 天前
【计算机毕业设计】基于Spring Boot的宠物领养管理系统
java·spring boot·后端·vue·毕业设计·宠物
要开心吖ZSH2 天前
腾讯 IM 前端对接小白教程:医患一对一聊天(含自定义报告卡片)
vue·健康医疗·即时通讯·im
雪芽蓝域zzs3 天前
第十节:动态侧边栏菜单(根据路由 meta 自动渲染菜单)
javascript·vue.js·elementui
深念Y3 天前
07-SSR水合问题实战排查与修复记录
前端·vue·vite·nuxt·ssr·csr·水合
深念Y3 天前
NativeScript 移动端开发踩坑记录
前端·ui·vue·安卓·移动端·native·原生
avi91113 天前
【】js不同颜色(Vue 框架)今时今日2026年学编程入门(10月1日)
前端·vue.js·vue·vue框架·前端入门·vue入门·html上传
宠友信息4 天前
社区类源码开发实践中的仿小红书系统技术要点分析
java·spring boot·redis·mysql·uni-app·vue·内容运营
南城以南溫暖如初1474 天前
从零搭建24小时自助健身系统:技术选型与核心模块实战
java·spring boot·redis·mysql·vue·mybatis
_xaboy5 天前
开源表单设计器 FcDesigner 保存表单教程:toJson parseJson 回显
低代码·开源·vue·表单·fcdesigner
钛态5 天前
Vite 中的 CSS 工程化:从 CSS Modules 到 UnoCSS 的渐进式迁移
前端·vue·react·web