[Vuejs]-Vue.js property undefined?

2👍

Can you use a watch?

Something like this.

watch: {
   'corporation.slug': function(slug) {
       if(slug){
          this.fetchContacts();
       }
    } 
}

Now if parent component changes corporation.slug your child component will fetch contacts automatically.

-3👍

Your prop default value is whether a value, or a function. But if it is a function, it HAS TO return something:

props: {
    corporation: {
        default () {
            return []
        }
    }
},

Leave a comment