I have a Vue.js component defined as following:
module.exports = Vue.component('folder-preview', {
props: ['name', 'path', 'children', 'open'],
template: `...
`,
methods: mapActions([
]),
computed: mapState([
]),
data: ()=> {
console.log(this);
return {
collapsed: (this.open !== 'true')
}
}
});
Basically, I'm trying to keep collapsed as data local to the component, but take the value passed in the prop as the initial value. However, it seems like this.open is always undefined. In fact, console.logging this prints an empty object, and I can't seem to figure why.
Am I getting something wrong?