Skip to content

Commit

Permalink
feature(frontend): 前端支持 iframe 嵌入 #3958
Browse files Browse the repository at this point in the history
  • Loading branch information
hLinx authored and iSecloud committed Apr 18, 2024
1 parent e0611ed commit 2c2d145
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 3 deletions.
1 change: 1 addition & 0 deletions dbm-ui/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@blueking/date-picker": "0.0.72",
"@blueking/ip-selector": "0.0.1-beta.138",
"@blueking/notice-component": "2.0.0",
"@blueking/sub-saas": "^0.0.0-beta.6",
"@icon-cool/bk-icon-bk-biz-components": "0.0.4",
"@vueuse/core": "10.9.0",
"axios": "1.6.0",
Expand Down
8 changes: 8 additions & 0 deletions dbm-ui/frontend/src/SubApp.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div>
<DbRouterView style="height: 100%" />
</div>
</template>
<script setup lang="ts">
import DbRouterView from '@components/db-router-view/Index.vue';
</script>
5 changes: 4 additions & 1 deletion dbm-ui/frontend/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ import { setGlobalComps } from '@common/importComps';

import i18n from '@locales/index';

import { subEnv } from '@blueking/sub-saas';

import App from './App.vue';
import getRouter from './router';
import SubApp from './SubApp.vue';

import '@blueking/ip-selector/dist/styles/vue2.6.x.css';
import '@lib/bk-icon/iconcool';
Expand All @@ -40,7 +43,7 @@ dayjs.extend(tz);

window.changeConfirm = false;

const app = createApp(App);
const app = createApp(subEnv ? SubApp : App);
// 自定义全局组件
setGlobalComps(app);
const piniaInstance = createPinia();
Expand Down
7 changes: 5 additions & 2 deletions dbm-ui/frontend/src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ import getTicketsRoutes from '@views/tickets/routes';
import getVersionFilesRoutes from '@views/version-files/routes';
import getWhitelistRoutes from '@views/whitelist/routes';

import { connectToMain, rootPath } from '@blueking/sub-saas';

let appRouter: Router;

const renderPageWithComponent = (route: RouteRecordRaw, component: typeof BizPermission) => {
Expand Down Expand Up @@ -119,7 +121,7 @@ export default () => {

const routes = [
{
path: '/',
path: rootPath,
name: 'index',
redirect: {
name: 'serviceApply',
Expand All @@ -136,7 +138,7 @@ export default () => {
],
},
{
path: `/${currentBiz}`,
path: `${rootPath}${currentBiz}`,
children: [
...getDbConfRoutes(),
...getESRoutes(bigdataController),
Expand Down Expand Up @@ -178,6 +180,7 @@ export default () => {
history: createWebHistory(),
routes,
});
connectToMain(appRouter)

let lastRouterHrefCache = '/';
const routerPush = appRouter.push;
Expand Down

0 comments on commit 2c2d145

Please sign in to comment.