File: D:/HostingSpaces/SBogers10/shop.komma.nl/resources/js/components/vue/cart/cartLink.vue
<template>
<a class="c-nav__link " :href="checkout.cartRoute" data-test="cart">{{ trans('shop/cart').cart }} ({{ checkout.totalItemsCount }})</a>
</template>
<script>
import { mapGetters, mapState } from "vuex";
export default {
components: {
},
computed: {
...mapGetters({
trans: "g11n/translation/translation" //Maps the getter function "translation" in vuex module g11n.js to a computed property called trans in this component
}),
...mapState({
checkout: "checkout", //Maps the state of the "checkout" vuex module to the computed property "checkout" on this component
})
},
created() {
this.$store.dispatch('g11n/translation/loadTranslations', [{ key: 'shop/cart' }]);
this.$store.dispatch('checkout/loadCheckoutInformation');
}
};
</script>