vue中的带默认参数的方法如何传递其他自定义参数

项目背景

在vue开发中,有些封装好的组件方法默认有回调参数,比如el-select的@change方法,这时候如果想自己再传递别的参数,该如何处理呢?

方法调用:
(defaultParam) => {
    
     handleMethod(defauleParam, customerParam) }
el-select的@change方法:
<el-select v-model="form.type" @change="(val) =>{ onTypeChange(val, 1) }">
    <el-option v-for="item in typeOptions" :key="item.value" :label="item.label" :value="item.value"/>
</el-select>
// methods中方法实现,val是默认参数,type是自定义参数
onTypeChange(val, type){
    
    
    console.log(val);
    console.log(type);
},

おすすめ

転載: blog.csdn.net/sunshineTing2/article/details/128804794