Skip to content

Instantly share code, notes, and snippets.

Avatar

Nosa Obaseki c0depanda

View GitHub Profile
View cart.js
// import Vue
import Vue from 'vue';
export default {
state: {
cart: ["bread", "rice", "beans", "turkey"]
},
getters: {
// Fetch the total number of items in the cart
View mainstore.js
import Vue from 'vue'
import Vuex from 'vuex'
import state from './state'
import getters from './getters'
import mutations from './mutations'
import actions from './actions'
import cart from './modules/cart'
Vue.use(Vuex)