Tuesday 29 October 2019

vuex- map getters

https://stackoverflow.com/questions/48091687/how-exactly-does-the-spread-syntax-work-with-mapgetters


{
    computed: {
        ...mapGetters([
            'getter1',
            'getter2',
            'getter3'
        ]);
    }
}

{
    computed: {
        getter1() {
            return this.$store.getters.getter1;
        },
        getter2() {
            return this.$store.getters.getter2;
        },
        getter3() {
            return this.$store.getters.getter3;
        },
    }
}

No comments:

Post a Comment