代码
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;
},