12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- // 公共
- const module = {
- // 开启命名空间
- namespaced: true,
- // 仓库
- state: {
- iphoneX:false,
- curShop:{},
- tabIndex:0,
- editClassify:null, // manage/classify-form 编辑时保存的临时数据
- specData: null, // manage/spec-edit 编辑时临时保存
- skuItem: null, // manage/spec-item-form 编辑时临时保存
- curOrder: null, // index/refund 售后临时保存
- disparityData:null, // index/disparity 售后临时保存
- couponData:null, // manage/coupon/form 优惠券临时保存
- },
- // 同步方法
- mutations: {
- // 更新数据
- update(state, data) {
- for (let key in data) {
- if (data.hasOwnProperty(key)) {
- state[key] = data[key]
- }
- }
- },
- // 移除数据
- remove(state, name) {
- if (typeof name === 'string') {
- delete state[name]
- } else {
- for (let key in name) {
- if (name.hasOwnProperty(key)) {
- delete state[name[key]]
- }
- }
- }
- },
- // 移除所有数据
- removeAll(state) {
- for (let key in state) {
- if (state.hasOwnProperty(key)) {
- delete state[key]
- }
- }
- },
- },
- // 异步方法
- actions: {},
- }
- export default module
|