12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import mallConfig from '../../core/mallConfig.js';
- import User from "../../core/user";
- const state = {
- type: 'global',
- text: '加载中',
- color: '#ffffff',
- backgroundImage: '',
- isShow: false
- };
- const getters = {
- getType(state) {
- return state.type;
- },
- getText(state) {
- return state.text;
- },
- getColor(state) {
- return state.color;
- },
- getBackgroundImage: async function(state) {
- return state.backgroundImage;
- },
- getIsShow(state) {
- return state.isShow;
- }
- };
- const mutations = {
- mutSetLoading(state, data) {
- for (let item in data) {
- state[item] = data[item];
- }
- if (!state.backgroundImage) {
- mallConfig.getConfig().then(config => {
- state.backgroundImage = config.__wxapp_img.mall.loading;
- });
- }
- },
- };
- const actions = {
- actionGetLoading(context, data) {
- context.commit('mutSetLoading', data);
- },
- };
- export default {
- namespaced: true,
- state,
- getters,
- mutations,
- actions
- }
|