Skip to content
This repository has been archived by the owner on Mar 7, 2024. It is now read-only.

Commit

Permalink
fix: 修复插件环境没有 getApp 导致的报错
Browse files Browse the repository at this point in the history
  • Loading branch information
yesmeck committed Apr 22, 2021
1 parent f148c5f commit 7a4daf2
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/remax-runtime/src/createPageConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ export function resetPageId() {
}

export default function createPageConfig(Page: React.ComponentType<any>, name: string) {
const app = getApp() as any;
let app: any;
try {
app = getApp();
} catch (e) {
app = null;
}

const config: any = {
data: {
Expand Down Expand Up @@ -74,7 +79,9 @@ export default function createPageConfig(Page: React.ComponentType<any>, name: s
this.callLifecycle(Lifecycle.unload);
this.unloaded = true;
this.container.clearUpdate();
app._unmount(this);
if (app) {
app._unmount(this);
}
},

onTabItemTap(this: any, e: any) {
Expand Down

1 comment on commit 7a4daf2

@vercel
Copy link

@vercel vercel bot commented on 7a4daf2 Apr 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.