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 loading: TComponent | null = null;
public registerRenderer(renderer: TComponent): any {
registerRenderer(renderer: TComponent): any {
this.renderer = renderer;
}
public registerLayout(componentName: string, Layout: TComponent): any {
registerLayout(componentName: string, Layout: TComponent): any {
if (!componentName || !Layout) {
return;
}
this.layouts[componentName] = Layout;
}
public registerLoading(component: TComponent) {
registerLoading(component: TComponent) {
if (!component) {
return;
}
this.loading = component;
}
public getLayout(componentName: string) {
getLayout(componentName: string) {
if (!componentName) {
return;
}
return this.layouts[componentName];
}
public getRenderer(): TComponent | null {
getRenderer(): TComponent | null {
return this.renderer;
}
public getLoading(): TComponent | null {
getLoading(): TComponent | null {
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;
if (getPageData && !this.state.schema) {
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 { schema } = this.state;
const Renderer = Boot.getRenderer();

View File

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