Skip to content

Commit 4a6e34a

Browse files
committed
add data
1 parent 88346c5 commit 4a6e34a

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

index.html

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,24 @@
99
</div>
1010
<script type='x-template' id='tree'>
1111
<div>
12-
Hello
12+
<div v-for="file in files">
13+
{{file.name}}<span v-if="file.tag == 'folder'">/</span>
14+
</div>
1315
</div>
1416
</script>
1517
<script>
18+
let files = [
19+
{tag: 'folder', name: 'dir1'},
20+
{tag: 'folder', name: 'dir2'},
21+
{tag: 'file', name: 'file1'}
22+
]
1623
Vue.component('tree',{
17-
template: '#tree'
24+
template: '#tree',
25+
data(){
26+
return {
27+
files
28+
}
29+
}
1830
})
1931
new Vue({
2032
el: '#app'

0 commit comments

Comments
 (0)