element-UI 事件添加额外自定义参数

 
 

要想在element的 event事件中增加自定义参数,如果你直接在方法中写,他就会将原来的参数覆盖!

例如:

 <input :value="scope.row.confirmAmount" @change="updateConfirmAmount(scope.row)" placeholder="请输入审核数量" />

但是你可以在自定义参数之前加入 $event 这个变量,然后再传其他值,这样的话event事件的回调参数就会有了。

例如:

 
 <input :value="scope.row.confirmAmount" @change="updateConfirmAmount($event, scope.row)" placeholder="请输入审核数量" />


下面是我今天解决问题的案例:

<!-- 明细列表 -->
<el-table :data="midSubmitDetailTableData"   border stripe style="width: 100%">
    <el-table-column prop="submitAmount" label="本次交工数量"></el-table-column>
    <el-table-column prop="confirmAmount" label="审核数量">
        <template slot-scope="scope">
            <input :value="scope.row.confirmAmount" @change="updateConfirmAmount($event, scope.row)" placeholder="请输入审核数量" />
        </template>    
    </el-table-column>
</el-table>

对应的方法:

updateConfirmAmount(data, row){
    var _value = data.currentTarget._value;
    var value = data.currentTarget.value;
		
},

最后抱怨一句:csdn的编译器越来越不好用了!

猜你喜欢

转载自blog.csdn.net/qq_35170213/article/details/80841233