I wanted to use the change callback function when I was doing the carousel, but the official document had only one line listed, no sample code at all (or maybe I didn't find it).
Tinkering for a while, patchwork finally found a reliable way to use, in fact, very simple
Add @change= "XXX" to the Carousel component
Like what
<indicator-position= "None" arrow= "Never" height = "550px" style = "width:1300px" @change = "Carouselchange" >
@change is the official definition of the event name, XXX is your own definition of the method name, triggering the Change event will invoke the method you defined,
The parameters Key1 and Key2, which are defined in the method, correspond to the officially defined callback parameters (the index of the currently active slide and the index of the original slide)
Methods: { carouselchange:function (Key1, Key2) { Console.log (key1 + ",,, *," + Key2); } }
Run to see the effect
The function was successfully triggered and two callback parameters were obtained
Element-ui callback function usage of events