update deps + eslint + element as second arg on mount
This commit is contained in:
+10
-2
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable prefer-const */
|
||||
import "systemjs/dist/system";
|
||||
import "systemjs/dist/extras/amd";
|
||||
import "systemjs/dist/extras/named-register";
|
||||
@@ -16,6 +17,13 @@ const systemJSImport = async (requestUrl: string) => {
|
||||
return { component, mount, unmount }
|
||||
}
|
||||
|
||||
let mainMountElement = document.getElementById('app');
|
||||
|
||||
if (!mainMountElement) {
|
||||
mainMountElement = document.createElement('div');
|
||||
mainMountElement.id = 'app';
|
||||
}
|
||||
|
||||
export default async ({ apps: rawApps, navigations, config, features }) => {
|
||||
defineVirtualModule({ navigations, config, features })
|
||||
|
||||
@@ -38,7 +46,7 @@ export default async ({ apps: rawApps, navigations, config, features }) => {
|
||||
}
|
||||
|
||||
let { component, mount, unmount } = await getApp()
|
||||
mount(component.default);
|
||||
mount(component.default, mainMountElement);
|
||||
|
||||
history.listen(async (location) => {
|
||||
if (location.pathname !== prevPathname) {
|
||||
@@ -46,7 +54,7 @@ export default async ({ apps: rawApps, navigations, config, features }) => {
|
||||
unmount()
|
||||
|
||||
const nextApp = await getApp();
|
||||
nextApp.mount(nextApp.component.default)
|
||||
nextApp.mount(nextApp.component.default, mainMountElement)
|
||||
unmount = nextApp.unmount;
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user