Element-ui callback function usage of events

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.