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;
    },
相关推荐
南城以南溫暖如初14710 小时前
社区健身小程序开发流程详解:技术选型与实施经验分享
java·经验分享·spring boot·mysql·vue·apache
万亿少女的梦16812 小时前
基于Spring Boot、Vue与MySQL的私人健身教练预约管理系统设计
java·spring boot·mysql·vue·预约管理
Sterting1 天前
Form表单与校验
javascript·vue.js·elementui
满栀5852 天前
vue动态路由效果
前端·javascript·vue.js·前端框架·vue
碧水澜庭2 天前
头条【vue+fastapi 】全栈教学项目系列之《02_双系统零基础环境搭建手册》
vue·fastapi
Sterting3 天前
Element-Plus 入门与整体布局
前端·vue.js·elementui
yume_sibai3 天前
Element Plus 基础组件完全指南(12个核心组件)
前端·elementui
DsirNg4 天前
从 `@wheel.prevent.stop` 到事件捕获:一次讲清浏览器事件流与 Vue 事件修饰符
javascript·vue·事件修饰符·事件冒泡·dom 事件·事件捕获·wheel
其美杰布-富贵-李4 天前
Vue 3 模板语法速通:彻底理解 `:`、`@`、`#`、`v-if`、`v-for` 与 `v-model`
vue
DsirNg5 天前
基于拓扑排序的画布自动布局:用最长上游路径决定节点列级
vue·流程图·拓扑排序·状态管理·有向图·自动布局·最长路径