报错:X [ERROR] The symbol "user" has already been declared,如何解决问题?
// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
import user from './mudules/user'
import map from './mudules/map'
import getters from './getters'
import account from "./mudules/account";
Vue.use(Vuex) // vue的插件机制
// Vuex.Store 构造器选项
const store = new Vuex.Store({
modules: {
user,
map,
account
},
getters,
state: {
patrolStatus: null,
patrolRiverId: null,
sysInfo: {},
loginSuccessRedirectPage: null,
sysconfigs: null
},
mutations: {
setLoginSuccessRedirectUrl(state, page) {
state.loginSuccessRedirectPage = page;
uni.setStorage({
key: "loginSuccessRedirectPage",
data: page
})
},
changePatrolStatus(state, data) {
state.patrolStatus = data
},
setSysconfigs(state, data) {
state.sysconfigs = data;
}
}
})
export default store
// #endif
// #ifdef VUE3
import { createStore } from 'vuex';
import user from './mudules/user'
import map from './mudules/map'
import getters from './getters'
import account from "./mudules/account";
const store = createStore({
modules: {
user,
map,
account
},
getters,
state() {
return {
patrolStatus: null,
patrolRiverId: null,
sysInfo: {},
loginSuccessRedirectPage: null,
sysconfigs: null
};
},
mutations: {
setLoginSuccessRedirectUrl(state, page) {
state.loginSuccessRedirectPage = page;
uni.setStorage({
key: "loginSuccessRedirectPage",
data: page
});
},
changePatrolStatus(state, data) {
state.patrolStatus = data;
},
setSysconfigs(state, data) {
state.sysconfigs = data;
}
}
});
export default store;
// #endif
0 个回复