A
A
andrei_pro2019-07-07 10:54:14
Vue.js
andrei_pro, 2019-07-07 10:54:14

Mixins not vuejs reactive?

Hello.
Are mixins reactive in view?
mixin.js

export const mixin = {
    data() {
        return {
            hover: null,
        }
    },
}

product.vue
import {mixin} from '../../../../mixins/mixin'

export default {
mixins: [mixin],
}

shop.vue
import {mixin} from '../../../../mixins/mixin'

export default {
mixins: [mixin],
}

in product.vue
I do it on click:
onClick() {
this.hover = 123
}
in product.vue it displays all the rules, in shop.vue hover = null

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alex, 2019-07-07
@andrei_pro

this is what you can do

0
0xD34F, 2019-07-07
@0xD34F Vue.js

in product.vue I do it when clicking <...> in product.vue it displays all the rules, in shop.vue hover = null

That's right, hover in product and hover in shop are different properties, one has nothing to do with the other. Changing a property in one component will not affect the other in any way. If you want it to have an effect - instead of a mixin, bring this hover to vuex, for example.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question