E
E
Evtera2021-10-25 12:06:32
Vue.js
Evtera, 2021-10-25 12:06:32

Computed properties in VUE 2 don't merge?

Hello. There are different components with the same computed property. This property accepts data by key from data. The keys in the components are different.

Decided to use a mixin. It would use

computed: {
    dateRangeFormat() {
    
      const data = {
        start: '',
        end: '',
      };
    };


And in the components themselves, I would already overwrite it in the form

const data = [
        this.filtersData.datePicker[0],
         this.filtersData.datePicker[1],
       ];


but as I understand it, unlike the / data hooks, the merging of computed properties in vue 2 does not work. Correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2021-10-25
@Evtera

It's not clear what you want, but it works.

Or do you want to somehow connect the results of multiple computed with the same name from different minxins? 0_o
If so, then first answer what problem you want to solve with this, because I think you are doing something wrong.
However, if you really want to, Vue allows you to set up custom merge strategies , including for computed:

But this should be used with caution, because. strategies are changing globally.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question