当我们不传参数时可以直接获取
html代码
<template>
<div @click="chenbushui">
不传参数
</div>
</template>
js代码
<style>
methods:{
chenbushui(event){
console.log(event) // 此时我们可以直接拿到event
}
}
</style>
当我们需要传入参数时,使用…arguments
html代码
<template>
<div @click="chenbushui(...arguments)">
传参数
</div>
</template>
js代码
<style>
methods:{
chenbushui(a){
console.log(a) // 此时我们打印形参a就可以拿到event
}
}
</style>