import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    langStr: "cn", // 语言
    countryArr: [], // 国家城市列表
    cityItemObj: {}, // 所选城市名称、ID
    areaCountryArr: [], // 国家区号列表
    areaCodeObj: {}, // 所选国家区号
    userObj: {}
  },
  mutations: {
    setLangStr(state, lang) {
      state.langStr = lang;
    },
    setCountryArr(state, countryArr) {
      state.countryArr = countryArr;
    },
    setCityItemObj(state, cityItem) {
      state.cityItemObj = cityItem;
    },
    setAreaCountryArr(state, areaCountry) {
      state.areaCountryArr = areaCountry;
    },
    setAreaCodeObj(state, cityItem) {
      state.areaCodeObj = cityItem;
    },
    setUserObj(state, userItem) {
      state.userObj = userItem;
    }
  },
  actions: {}
});
