feat(XPack): 路由配置

This commit is contained in:
fit2-zhao 2021-03-03 18:47:09 +08:00
parent 032b9e16e1
commit d40fe759a9
2 changed files with 8 additions and 5 deletions

View File

@ -29,15 +29,15 @@
</template>
<script>
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const report = requireComponent.keys().length > 0 ? requireComponent("./report/ReportAnalysis.vue") : null;
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
const report = requireContext.keys().map(key => requireContext(key).report);
const isReport = report && report != null && report.length > 0 && report[0] != undefined ? true : false;
export default {
name: "MsTopMenus",
data() {
return {
activeIndex: '/',
isReport: report
isReport: isReport
}
},
watch: {

View File

@ -5,7 +5,10 @@ import Setting from "@/business/components/settings/router";
import API from "@/business/components/api/router";
import Performance from "@/business/components/performance/router";
import Track from "@/business/components/track/router";
const requireContext = require.context('@/business/components/xpack/', true, /router\.js$/)
const Report = requireContext.keys().map(key => requireContext(key).report);
const ReportObj = Report && Report != null && Report.length > 0 && Report[0] != undefined ? Report : [{path: "/sidebar"}];
Vue.use(VueRouter);
@ -22,7 +25,7 @@ const router = new VueRouter({
API,
Performance,
Track,
...requireContext.keys().map(key => requireContext(key).report),
...ReportObj
]
});