vue-typescript-admin-template icon indicating copy to clipboard operation
vue-typescript-admin-template copied to clipboard

注册Module的问题

Open wangpiao2 opened this issue 6 years ago • 0 comments

您好,我是来自成都一名.NET开发者,最近在第一次使用您的模板构建项目,项目中您使用了vuex-module-decorators,您的项目中: Vue.use(Vuex)

export interface IRootState { app: IAppState user: IUserState tagsView: ITagsViewState errorLog: IErrorLogState permission: IPermissionState settings: ISettingsState //waterUnit:WaterUnitState }

// Declare empty store first, dynamically register all modules later. export default new Vuex.Store<IRootState>({ })

我这边的项目中:  const store = new Vuex.Store({ state: { // }, mutations: { // }, actions: {

},
modules: {
    document,
    documentType,
    trainingPlanPeople,
    exam
}

}); 有些modules没有使用vuex-module-decorators装饰器,因此注册的时候我需要这样去注册,但是这样又和您项目中的结合要报错,我只有动态手动去注册,销毁:在vue文件中this.$store.registerModule("waterUser",WaterUserModule);this.$store.unregisterModule("waterUser"); 这样的话太麻烦了,并且不销毁的话,会出现很多的数据重复,这个我该怎么去整合到您的项目呢?在原来的基础上,后面的开发不用vuex-module-decorators

谢谢您,占用了您宝贵的时间。

wangpiao2 avatar Aug 07 '19 04:08 wangpiao2