标签绑定一个事件处理函数,然后在相应的事件处理函数中调用想要触发的多个处理函数
以下两种方案,都可以实施
第一种
<button id="test" @click="test1">按钮</button>
new Vue({
el:"#test",
data:"",
methods:{
test1:function(){
alert("test1");
this.test2();
this.test3();
},
test2:function(){
alert("test2");
},
test3:function(){
alert("test3");
}
}
})
第二种:
绑定多个事件时,事件之间使用分号“;”分开即可
<el-button type="primary" size="small" @click="add1();add2();">123</el-button>
去methods中添加事件的函数
methods:{
add1(){
console.log(123)
},
add2(){
console.log(456)
},
}