<!DOCTYPE html>
<html>
<body>
<div id="app">
<!-- 没有参数是否带括号都行 -->
<button @click="btnclick()">按钮1(无参,带括号)</button>
<button @click="btnclick">按钮2(无参,不带括号)</button>
<button @click="btn2click()">按钮3(有参,不传带括号)</button>
<button @click="btn2click">按钮4(有参,不传,不带括号)</button>
<!-- 会自动传递event对象 -->
<button @click="btn3click">按钮5(有多个参,不传,不带括号)</button>
<!-- 将event传给了s,于是监听函数中,s输出为event,真正的event没有被赋值为undefined -->
<button @click="btn3click(123,$event)">按钮5(有多个参数,传参,带括号)</button>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
var app=new Vue(
{el:"#app",
data:{
num:1
},
methods:{
btnclick()
{
console.log('没有参数的情况')
},
btn2click(s)
{
console.log(s);
},
btn3click(s,event)
{
console.log('s:'+s);
console.log('event:'+event);
},
}
})</script>
</body>
</html>
运行结果: