0
votes

Is it even possible?

I know I can do it like this:

computed: {
        ...mapGetters({
            xyz: 'xyz'
        }),

but I was wondering if I can do it using inherited mapGetters, i.e. in created hook:

created () {
        this.$options.computed = Object.assign(this.$options.computed, {...this.dependencies.mapGetters(this.stores)});

        console.log(this.$options.computed); // returns mapped getters
    },

Console output returns mapped getters, but it doesn't seem to work, in Vue DevTools those Vuex bindings are undefined.

1
Why would you want to do that?acdcjunior
I have component xyz and A, B, C components are extending xyz. I'd rather import mapGetters in xyz, than in each A, B, C.van_folmert
"Extending" using Vue.extend()?acdcjunior
@acdcjunior yesvan_folmert

1 Answers

0
votes

No. You can't. There's no way around.

Also,

The $options is read only.