A
A
Alexander Koregin2020-01-12 11:57:39
Vue.js
Alexander Koregin, 2020-01-12 11:57:39

How to pass parameter to computed function?

I want to sort the list, but for this I need to pass a parameter to the computed function, in order to filter depending on the selected parameter.

computed: {
    goodsList() {
      switch (this.activeButtonSort) {
        case 0:
          return this.goods.filter(
            item => item.name_categories.indexOf(this.openBreadcrumbText) !== -1
          );
      }
    }
  },

And Vue.js throws an error
5e1adf8229870972227569.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Yarkov, 2020-01-12
@dragonika8

Make a Method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question