1234567891011121314151617181920212223242526272829 |
- import { queenApi } from "queenjs";
- import { Provider } from "queenjs/adapter/vue";
- import { createApp, defineComponent } from "vue";
- import { Router } from "vue-router";
- import "./styles";
- import zh_cn from "ant-design-vue/es/locale/zh_CN";
- let setModuleHooks: any[] = [];
- const App = defineComponent(() => {
- setModuleHooks.forEach((hook) => hook());
- setModuleHooks = [];
- return () => (
- <Provider locale={zh_cn}>
- <router-view></router-view>
- </Provider>
- );
- });
- export function startApp(
- router: Router,
- hooks: any[] = [],
- callback?: (app: ReturnType<typeof createApp>) => void
- ) {
- setModuleHooks = hooks;
- queenApi.router = router;
- const app = createApp(App);
- callback?.(app);
- app.use(router).mount("#app");
- }
|