27 lines
748 B
JavaScript
27 lines
748 B
JavaScript
import { renderWithQiankun, qiankunWindow } from 'vite-plugin-qiankun/dist/helper';
|
|
|
|
export const registerMicroApps = async (app) => {
|
|
const initQiankun = () => {
|
|
renderWithQiankun({
|
|
bootstrap() {
|
|
console.log('bootstrap');
|
|
},
|
|
mount(props) {
|
|
console.log('mount', props);
|
|
render(props);
|
|
},
|
|
update(props) {
|
|
console.log('update', props);
|
|
},
|
|
unmount(props) {
|
|
console.log('unmount', props);
|
|
},
|
|
});
|
|
};
|
|
const render = async ({ container }) => {
|
|
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
app.mount(container ? container.querySelector('#app') : '#app');
|
|
};
|
|
qiankunWindow.__POWERED_BY_QIANKUN__ ? initQiankun() : render({});
|
|
};
|