Skip to content

Commit 022a9fc

Browse files
committed
handle events
1 parent 4a6e34a commit 022a9fc

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

index.html

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@
99
</div>
1010
<script type='x-template' id='tree'>
1111
<div>
12-
<div v-for="file in files">
13-
{{file.name}}<span v-if="file.tag == 'folder'">/</span>
14-
</div>
12+
<div v-for="file in files">
13+
<div v-if="file.tag == 'folder'" v-on:click='toggleExpand()'>
14+
{{file.name}}/
15+
</div>
16+
<div v-else>
17+
{{file.name}}
18+
</div>
19+
</div>
1520
</div>
1621
</script>
1722
<script>
@@ -22,6 +27,11 @@
2227
]
2328
Vue.component('tree',{
2429
template: '#tree',
30+
methods: {
31+
toggleExpand: function(){
32+
console.log('togglin!')
33+
}
34+
},
2535
data(){
2636
return {
2737
files
@@ -33,4 +43,4 @@
3343
})
3444
</script>
3545
</body>
36-
</html>
46+
</html>

0 commit comments

Comments
 (0)