[Vuejs]-Component computed property is undefined

0👍

I already have a similar problem because computed had to have a setter and a getter like this :

  computed: {
    fullName: {
      // getter
      get: function () {
       return this.firstName + ' ' + this.lastName
     },
     // setter
     set: function (newValue) {
       var names = newValue.split(' ')
       this.firstName = names[0]
       this.lastName = names[names.length - 1]
     }
   }
}

Leave a comment