{"size": 964, "ext": "js", "max_stars_repo_path": "resources/js/store/store.js", "max_stars_repo_name": "elizabethnesen/laravue", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "resources/js/store/store.js", "max_issues_repo_name": "elizabethnesen/laravue", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "resources/js/store/store.js", "max_forks_repo_name": "elizabethnesen/laravue", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 20.9565217391, "max_line_length": 48, "alphanum_fraction": 0.3682572614}
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
    state:{
        items:[
            {
                title: 'Яблоко',
                count: 0,
                price: 10,
                showItem: false
            },
            {
                title: 'Апельсин',
                count: 0,
                price: 30,
                showItem: false
            },
            {
                title: 'Банан',
                count: 0,
                price: 15,
                showItem: false
            }
        ]
    },
    getters:{
        getItems: state=>state.items
    },
    actions:{
        addPosition(context, items){
            context.commit('addPosition', items)
        }
    },
    mutations:{
        addPosition(state, [title, price]){
            state.items.push({
                title:title,
                count: 0,
                price: price,
            })
        }
    }
})