Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(gi-sdk-app): 支持自定义loading #571

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
perf(gi-sdk-app): 支持自定义loading
gegenhasi committed Jan 9, 2024
commit 132e7e4be3dea45880ece715a40bc7b690c4a2f7
7 changes: 5 additions & 2 deletions packages/gi-sdk-app/src/index.tsx
Original file line number Diff line number Diff line change
@@ -41,10 +41,12 @@ export interface StudioProps {
id: string;
service: (id: string) => Promise<{ data: Project }>;
loadingText?: string;
loadingComponent?: React.ReactElement;
}

const Studio: React.FunctionComponent<StudioProps> = props => {
const { id, service, loadingText = '正在加载图应用...' } = props;
// @ts-ignore
const { id, service, loadingText = '正在加载图应用...', loadingComponent } = props;
const [state, setState] = React.useState({
isReady: false,
assets: null,
@@ -116,7 +118,8 @@ const Studio: React.FunctionComponent<StudioProps> = props => {
}, []);
const { assets, isReady, config, services, ThemeComponent, GISDK } = state;
if (!isReady) {
return <Loading title={loadingText} />;
// 支持传入自定义loading组件
return loadingComponent ?? <Loading title={loadingText} />;
}

return (