Skip to content

Instantly share code, notes, and snippets.

@ChadTaljaardt
Created September 26, 2016 14:45
Show Gist options
  • Save ChadTaljaardt/73fc329d2cf39860ac157555cf9194a1 to your computer and use it in GitHub Desktop.
Save ChadTaljaardt/73fc329d2cf39860ac157555cf9194a1 to your computer and use it in GitHub Desktop.
<style>
</style>
<template>
</template>
<script>
console.log("test");
export default {
props: {
model: Object
},
data: function () {
return {
open: false
}
},
computed: {
isFolder: function () {
return this.model.children &&
this.model.children.length
}
},
methods: {
toggle: function () {
if (this.isFolder) {
this.open = !this.open
}
},
changeType: function () {
if (!this.isFolder) {
Vue.set(this.model, 'children', [])
this.addChild()
this.open = true
}
},
addChild: function () {
this.model.children.push({
name: 'new stuff'
})
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment