一,实现思路
其实就是让command属性绑定一个对象,然后对象中就可以传入多个参数了。
二,具体代码
<el-table-column
prop="operation"
label="操作"
align="center"
width="180">
<template slot-scope="scope">
<div class="operationVid">
<span class="operationBef" @click="payList(scope)" v-if="handleMenu_1(scope.row)=='付款'">付款</span>
<span class="operationBef" @click="operFinish(scope)" v-if="handleMenu_1(scope.row)=='完成'">完成</span>
<span class="operationBef" @click="operFinish(scope)" v-if="handleMenu_1(scope.row)=='审核'">审核</span>
<el-dropdown trigger="click" @command="handleCommand">
<span class="el-dropdown-link">
更多<i class="el-icon-arrow-down el-icon--right"></i>
</span>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item :command="beforeHandleCommand(scope,'订单详情')" v-if="handleMenu_2(scope.row).has('订单详情')">订单详情</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope,'前台打印')" v-if="handleMenu_2(scope.row).has('前台打印')">前台打印</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope,'后厨打印')" v-if="handleMenu_2(scope.row).has('后厨打印')">后厨打印</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope,'订单退款')" v-if="handleMenu_2(scope.row).has('订单退款')">订单退款</el-dropdown-item>
<el-dropdown-item :command="beforeHandleCommand(scope,'关闭订单')" v-if="handleMenu_2(scope.row).has('关闭订单')">关闭订单</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</div>
</template>
</el-table-column>
//操作中的按钮
handleCommand(command) {
switch (command.command) {
case '订单详情':
this.toDetail(command.scope,'订单详情')
break;
case '前台打印':
this.print(command.scope,1)
break;
case '后厨打印':
this.print(command.scope,0)
break;
case '订单退款':
// this.ordersRefund(command.scope,)
this.toDetail(command.scope,'订单退款')
break;
case '关闭订单':
//tppe:2是指单个订单关闭
this.closeOrder(command.scope,2)
break;
default:
break;
}
},
//配置command的参数
beforeHandleCommand(scope,command){
return {
'scope':scope,
'command':command
}
},