1.模板:

back组件为封装的一个简单的组件 无关紧要;
2.data:

定义的title和shijian(事件)这两个是要循环的
3.关键:
3.1:

这是一个方法这就是关键的diaoshijian()(调事件方法)可以看到穿了一个参数:

tab.shijian 和方法里面的methodsWords对应
3.2
接着我在下面定义a,b,c,d四个事件

方法
diaoshijian(methodsWords) {
thismethodsWords
}中的thismethodsWords 一定要这么写 不然会有问题 不要写成
this.methodsWords()
以上就是绑定不同vue循环绑定不同事件的方法了
网友评论