javascript - Several places on a page need to be clicked to display and then clicked to hide. How to implement this in Vue?
phpcn_u1582
phpcn_u1582 2017-05-19 10:13:09
0
6
491

As shown in the figure, click on the first li and all the p's of li will be displayed.
Clicking on the second li, the first li and the third li have also changed. How can I click which li and display the p element in which li? . .



##

phpcn_u1582
phpcn_u1582

reply all(6)
小葫芦

Set one current

@click = "current = 1"
v-show = "current == 1"
Peter_Zhu

You’ll understand if you look at the code:

Peter_Zhu

Correct answer on the first floor. You can also use v-if. However, it is recommended that the @click binding function be written in a more standardized way in methods.

我想大声告诉你

Think data driven⤴

为情所困

Should this be written using event delegation? You bind click to ul, determine which li the clicked event.target is, and then switch the display, it should be fine

PHPzhong

Set three variables

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template