Vue implements active click switch, and vueactive click Switch

Source: Internet
Author: User

Vue implements active click switch, and vueactive click Switch

Loop:

1. input the index when you click (obtain the currently clicked index)

@ Click = "active (index )"

2. Pass the index value into the class (when the index is equal to a few, the first few to add the active class)

: Class = "{active: index = ins }"

3. Add ins: 0 in data (indicating that the first active class is added by default)

Data {ins: 0}

4. Add the method in methods.

Ctive (num) {this. ins = num}

Non-circular:

1. Write click events and added class styles into the tag.

Note: class = "{active: shows = 1}" means to add class = active when shows = 1; otherwise, no.

2. Define methods in methods

The effect is as follows:

This completes the click switching effect.

Additional:

Filter arrow switching using the three trees Operator

The above Vue implementation active click switch method is all the content shared by Alibaba Cloud xiaobian. I hope to give you a reference and support for the customer's house.

Related Article

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.