Difference Between Vue Computed Properties vs Methods

Hey vue js developers, do you know what is the core difference between vue methods and vue computed properties? There is a core difference between them. In this vue js beginners tutorial we will learn what is the core difference between vue computed properties and vue methdos properties. 

If you already know vue js methods properties, you may wonder what’s the difference. Keep in mind First, methods must be called, not just referenced, so you’d need to do call count() instead of count if you have a count method.

export default {
  data() {
    return {
      items: [1, 2, 3]
    }
  },
  methods: {
    count: function() {
      return 'The count is ' + this.items.length * 10
    }
  }
}

 

But in computed properties, the main difference is that computed properties are cached. The result of the count computed property is internally cached until the items data property changes. Keep in mind that computed properties are only updated when a reactive source updates.

Regular JavaScript methods are not reactive, so a common example is to use Date.now():

 

Hope you have understand about vue computed properties and vue method and their difference.