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;
    },
相关推荐
集成显卡21 小时前
前端视频播放方案选型:主流 Web 播放器对比 + Vue3 实战
前端·vue·音视频
克里斯蒂亚诺·罗纳尔达21 小时前
vue页面加载时间过长优化
vue
草根大哥1 天前
AI编程实践-homex物业管理平台(Go + Vue3 + MySQL 多租户落地)
mysql·golang·vue·ai编程·gin·物业管理系统·多租户
泓博1 天前
Android中仿照View selector自定义Compose Button
android·vue.js·elementui
1314lay_10072 天前
Vue3 + Element Plus项目和C# .Net 7.0 Core后端API项目发布部署到服务器
服务器·前端·javascript·vue.js·elementui·c#·.net
未来龙皇小蓝2 天前
RBAC前端架构-03:创建dotenv及config配置
前端·vue
pan3035074793 天前
Vue3+element plus设计多租户组织机构
javascript·vue.js·elementui
见路不走!4 天前
vue3中使用el-cascader三级联动(动态获取数据)
javascript·vue.js·elementui
Aric_Jones4 天前
文章详情页 AI 快速阅读功能实现
java·网络·人工智能·spring boot·vue
千寻技术帮4 天前
10352_基于Springboot的房屋销售平台
java·spring boot·mysql·vue·源码·代码·远程