//store/modules/user.js
// 声明变量
const state = {
    collapse: false,
    activeIndex:1,
    username:'',
    password:'',
    api:'/carstop/carbook',

};

// 修改变量（state不能直接赋值修改，只能通过mutations）
const mutations = {
    menuClose: (state, value) => {
        state.collapse = value;
    },
    indexUp: (state, value) => {
        state.activeIndex = value;
    },
    userName:(state,value)=>{
        state.username=value
    },
    passWord:(state,value)=>{
        state.password=value
    }
};
// mutations的值由actions传入(异步)
const actions = {
    addAsync: ({ commit }) => {
        setTimeout(() => {
            commit("add");
        }, 1000);
    },
};

export default {
    state,
    mutations,
    actions,
};
