fix: 修复启用禁用模块顶部没有刷新的问题

This commit is contained in:
Captain.B 2021-06-17 19:00:53 +08:00 committed by 刘瑞斌
parent 03293013ad
commit 3c8694181f
1 changed files with 11 additions and 0 deletions

View File

@ -38,6 +38,7 @@
import {LicenseKey} from '@/common/js/constants'; import {LicenseKey} from '@/common/js/constants';
import {mapGetters} from "vuex"; import {mapGetters} from "vuex";
import {hasLicense} from "@/common/js/utils"; import {hasLicense} from "@/common/js/utils";
import {MODULE_CHANGE, ModuleEvent} from "@/business/components/common/head/ListEvent";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/); const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/);
const report = requireContext.keys().map(key => requireContext(key).report); const report = requireContext.keys().map(key => requireContext(key).report);
@ -80,6 +81,7 @@ export default {
} }
} }
this.registerEvents();
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
@ -106,6 +108,15 @@ export default {
} }
return true; return true;
}, },
registerEvents() {
ModuleEvent.$on(MODULE_CHANGE, () => {
if (module.default) {
module.default.listModules(this).then(() => {
this.menuKey++;
});
}
});
}
} }
}; };
</script> </script>