87 lines
2.1 KiB
JavaScript
87 lines
2.1 KiB
JavaScript
import { createApp } from "vue";
|
|
import "./assets/styles/tailwind.css";
|
|
import Cookies from "js-cookie";
|
|
import "@/utils/flexible.js";
|
|
import ElementPlus from "element-plus";
|
|
import "element-plus/dist/index.css";
|
|
import locale from "element-plus/es/locale/lang/zh-cn";
|
|
|
|
import "@/assets/styles/index.scss";
|
|
|
|
import App from "./App";
|
|
import store from "./store";
|
|
import router from "./router";
|
|
import directive from "./directive"; // directive
|
|
import { qomoPlatformOptions } from "./platform";
|
|
import QomoPlatform from "@qomo-platform/core";
|
|
|
|
// 注册指令
|
|
import plugins from "./plugins"; // plugins
|
|
|
|
import {
|
|
renderWithQiankun,
|
|
qiankunWindow
|
|
} from "vite-plugin-qiankun/dist/helper";
|
|
|
|
// svg图标
|
|
import "virtual:svg-icons-register";
|
|
import usePermissionStore from "@/store/modules/permission";
|
|
import "@/assets/styles/global.css";
|
|
import FlowableComponents from "@/flowableComponents/index.ts"
|
|
let app;
|
|
|
|
function render(props = {}) {
|
|
const { container } = props;
|
|
|
|
app = createApp(App);
|
|
app.use(store);
|
|
usePermissionStore()
|
|
.generateRoutes()
|
|
.then(routes => {
|
|
routes.forEach(route => {
|
|
if (!isHttp(route.path)) {
|
|
router.addRoute(route); // 动态添加可访问路由表
|
|
}
|
|
});
|
|
app.use(router);
|
|
app.use(plugins);
|
|
|
|
app.use(QomoPlatform, qomoPlatformOptions);
|
|
app.use(FlowableComponents);
|
|
directive(app);
|
|
|
|
// 使用element-plus 并且设置全局的大小
|
|
app.use(ElementPlus, {
|
|
name:'testApp',
|
|
locale: locale,
|
|
// 支持 large、default、small
|
|
size: Cookies.get("size") || "default"
|
|
});
|
|
|
|
app.mount(container ? container.querySelector("#subApp") : "#subApp");
|
|
});
|
|
}
|
|
|
|
if (!qiankunWindow.__POWERED_BY_QIANKUN__) {
|
|
render();
|
|
} else {
|
|
renderWithQiankun({
|
|
mount(props) {
|
|
console.log("===mount===");
|
|
render(props);
|
|
},
|
|
bootstrap() {
|
|
console.log("===bootstrap===");
|
|
},
|
|
unmount(props) {
|
|
console.log(app);
|
|
console.log("===unmount===");
|
|
const { container } = props;
|
|
app.unmount();
|
|
},
|
|
update(props) {
|
|
console.log("===update===", props);
|
|
}
|
|
});
|
|
}
|