Skip to content

Commit c6981c8

Browse files
committed
발표 중 사용한 코드
1 parent d58bb01 commit c6981c8

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

dom-handling/handling.html

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,15 @@
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
메뉴 설명
@@ -33,7 +41,7 @@
3341
<div class="child hide">
3442
메뉴 설명
3543
</div>
36-
</li>
44+
</li> -->
3745
</ul>
3846
</div>
3947

@@ -46,7 +54,8 @@
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
});

reacitivity/1_checkbox.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
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
},

0 commit comments

Comments
 (0)