[Vuejs]-How to convert a method into a computed property?

0👍

You don’t need a computed property, you can also make some method call. Computed properties perform better if called often, because the result gets cached, but otherwise from that there is no difference to a regular method call.

0👍

If I understand correctly you’re trying to pass a param to a computed property. In order to do this you need to define the computed property function to return a function with a param that you want to use.

computed: {
    getCalendar(){
      return myParam => {
          ...your computed property code using myParam
      }
    }
}

Leave a comment