Vue.js computed property not working Vue.js computed property not working vue.js vue.js

Vue.js computed property not working


I don't believe that a computed property in Vue.js can accept an argument, they are supposed to be able to build themselves without additional interaction. I believe that your fault was that you wrote a method and then tried to register it as a computed property.

So it should be a simple fix to just change the registration of your function from computed to methods which it really is.

methods: {       fullName: function (user) {            return user.first_name + ' ' + user.last_name;        }    }

This way you will not have to change any of your other code.


Try to disable cache on the computed property, like mentioned in https://github.com/vuejs/vue/issues/1189. Doing this, the computed value will be always recalculated.

computed: {  fullName: {    cache: false,    get() {      return user.first_name + ' ' + user.last_name;    }  }}


Computed properties don't support nesting like that.

Proof and some workarounds/alternative solutions: https://github.com/vuejs/vue/issues/66