File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change 1616 < body >
1717 < div id ="app ">
1818 < ul >
19- < li @click ="removeItem ">
19+ < li v-for ="(item, index) in items "
20+ @click ="removeItem(index) ">
21+ < span > {{ item }}</ span >
22+ < div class ="child hide " ref ="listItem ">
23+ 메뉴 설명
24+ </ div >
25+ </ li >
26+
27+ <!-- <li @click="removeItem">
2028 <span>메뉴 1</span>
2129 <div class="child hide">
2230 메뉴 설명
3341 <div class="child hide">
3442 메뉴 설명
3543 </div>
36- </ li >
44+ </li> -->
3745 </ ul >
3846 </ div >
3947
4654 } ,
4755 methods : {
4856 removeItem ( index ) {
49- event . target . lastChild . classList . toggle ( 'hide' ) ;
57+ this . $refs . listItem [ index ] . classList . toggle ( 'hide' ) ;
58+ // event.target.lastChild.classList.toggle('hide');
5059 } ,
5160 } ,
5261 } ) ;
Original file line number Diff line number Diff line change 4444 . then ( response => response . json ( ) )
4545 . then ( data => {
4646 this . users = data ;
47- // this.$set(this.users[0], 'checked', false);
47+ this . $set ( this . users [ 0 ] , 'checked' , false ) ;
4848 } )
4949 . catch ( error => console . log ( error ) ) ;
5050 } ,
You can’t perform that action at this time.
0 commit comments