element-UI change 事件传递自定义参数

4,348 阅读1分钟

背景:element 走马灯为例,自带一个回调函数 @change,我们无需添加参数,就能获取到目前激活的幻灯片的索引,原幻灯片的索引,那么我们如何传递自定义参数呢?

解决方法:

标签的 @change 事件:

@change="((pre, next) => {change(pre, next, 自定义参数)})"

methods 中定义:

change (pre, next, index) {
      console.log(pre, next, index);
    },

ok!大功告成~