@blueking/sub-saas
v0.0.0-beta.9
Published
蓝鲸 SAAS 作为子系统访问
Downloads
1,682
Readme
SAAS Iframe 访问分主系统(iframe 嵌入方),子系统(被嵌入方)
子系统使用
// router.js
import { rootPath, connectToMain } from '@blueking/sub-saas'
import { createRouter, createWebHistory } from 'vue-router';
const routes = [
{
path: rootPath,
children: [
{
path: 'index',
component: () => import("@view/index/index.vue")
}
]
}
]
const appRouter = createRouter({
history: createWebHistory(),
routes,
});
connectToMain(appRouter)
// main.js
import { createApp } from 'vue'
import { subEnv } from '@blueking/sub-saas'
import App from './app.vue';
import IframeApp from './iframe-app.vue';
createApp(subEnv ? IframeApp : App)
.mount('#app');
主系统使用(SAAS url path 拼接 /sub/)
vue3
<template>
<SubSaas src="http://xxx.job.com/sub" />
</template>
<script setup>
import SubSaas from '@blueking/sub-saas/vue3'
</script>
vue2
<template>
<SubSaas src="http://xxx.job.com/sub" />
</template>
<script setup>
import SubSaas from '@blueking/sub-saas/vue2'
</script>