chore: remove public identider

This commit is contained in:
wuyue.xht 2020-03-29 17:28:52 +08:00
parent 8174b42fa3
commit 904bd3d4a2
3 changed files with 19 additions and 18 deletions

View File

@ -7,36 +7,36 @@ class Trunk {
private layouts: { [key: string]: TComponent } = {}; private layouts: { [key: string]: TComponent } = {};
private loading: TComponent | null = null; private loading: TComponent | null = null;
public registerRenderer(renderer: TComponent): any { registerRenderer(renderer: TComponent): any {
this.renderer = renderer; this.renderer = renderer;
} }
public registerLayout(componentName: string, Layout: TComponent): any { registerLayout(componentName: string, Layout: TComponent): any {
if (!componentName || !Layout) { if (!componentName || !Layout) {
return; return;
} }
this.layouts[componentName] = Layout; this.layouts[componentName] = Layout;
} }
public registerLoading(component: TComponent) { registerLoading(component: TComponent) {
if (!component) { if (!component) {
return; return;
} }
this.loading = component; this.loading = component;
} }
public getLayout(componentName: string) { getLayout(componentName: string) {
if (!componentName) { if (!componentName) {
return; return;
} }
return this.layouts[componentName]; return this.layouts[componentName];
} }
public getRenderer(): TComponent | null { getRenderer(): TComponent | null {
return this.renderer; return this.renderer;
} }
public getLoading(): TComponent | null { getLoading(): TComponent | null {
return this.loading; return this.loading;
} }
} }

View File

@ -18,7 +18,7 @@ export default class LazyComponent extends Component<IProps, IState> {
}; };
} }
public async componentDidMount() { async componentDidMount() {
const { getPageData } = this.props; const { getPageData } = this.props;
if (getPageData && !this.state.schema) { if (getPageData && !this.state.schema) {
const schema = await getPageData(); const schema = await getPageData();
@ -26,7 +26,7 @@ export default class LazyComponent extends Component<IProps, IState> {
} }
} }
public render() { render() {
const { getPageData, ...restProps } = this.props; const { getPageData, ...restProps } = this.props;
const { schema } = this.state; const { schema } = this.state;
const Renderer = Boot.getRenderer(); const Renderer = Boot.getRenderer();

View File

@ -24,17 +24,18 @@ export interface IAppConfig {
} }
export default abstract class Provider { export default abstract class Provider {
public globalComponents: any = {}; globalComponents: any = {};
public globalUtils: any = {}; globalUtils: any = {};
public routerConfig: { [key: string]: string } = {}; routerConfig: { [key: string]: string } = {};
public layout: { componentName: string; props: any } | null = null; layout: { componentName: string; props: any } | null = null;
componentsMap: any = null;
private lazyElementsMap: { [key: string]: any } = {}; private lazyElementsMap: { [key: string]: any } = {};
constructor() { constructor() {
this.init(); this.init();
} }
public create(appkey: string): Promise<IAppData> { create(appkey: string): Promise<IAppData> {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
try { try {
const config = await this.getAppData(appkey); const config = await this.getAppData(appkey);
@ -49,21 +50,21 @@ export default abstract class Provider {
}); });
} }
public async init() { async init() {
console.log('init'); console.log('init');
} }
public async getAppData(appkey: string, restOptions?: any): Promise<object> { async getAppData(appkey: string, restOptions?: any): Promise<object> {
console.log('getAppData'); console.log('getAppData');
return {}; return {};
} }
public async getPageData(pageId: string, restOptions?: any): Promise<any> { async getPageData(pageId: string, restOptions?: any): Promise<any> {
console.log('getPageData'); console.log('getPageData');
return; return;
} }
public getLazyComponent(pageId: string, props: any): ReactElement | null { getLazyComponent(pageId: string, props: any): ReactElement | null {
if (!pageId) { if (!pageId) {
return null; return null;
} }
@ -82,7 +83,7 @@ export default abstract class Provider {
} }
} }
public createApp() { createApp() {
console.log('createApp'); console.log('createApp');
return; return;
} }