Skip to content
Permalink
Browse files

add folder component

  • Loading branch information...
jshawl committed Feb 2, 2017
1 parent 022a9fc commit 9b4bc3310f3d3f84033c28ebcf27376f7d1250b1
Showing with 15 additions and 8 deletions.
  1. +15 −8 index.html
@@ -10,15 +10,18 @@
<script type='x-template' id='tree'>
<div>
<div v-for="file in files">
<div v-if="file.tag == 'folder'" v-on:click='toggleExpand()'>
{{file.name}}/
</div>
<folder v-if="file.tag == 'folder'" :file='file'></folder>
<div v-else>
{{file.name}}
</div>
</div>
</div>
</script>
<script type="x-template" id='folder'>
<div v-on:click="toggleExpand()">
{{file.name}}/
</div>
</script>
<script>
let files = [
{tag: 'folder', name: 'dir1'},
@@ -27,17 +30,21 @@
]
Vue.component('tree',{
template: '#tree',
methods: {
toggleExpand: function(){
console.log('togglin!')
}
},
data(){
return {
files
}
}
})
Vue.component('folder',{
template: '#folder',
props: ['file'],
methods: {
toggleExpand: function(){
console.log('togglin!')
}
}
})
new Vue({
el: '#app'
})

0 comments on commit 9b4bc33

Please sign in to comment.
You can’t perform that action at this time.