修复 Page loading 不显示问题

This commit is contained in:
liaoxuezhi 2019-06-10 14:50:23 +08:00
parent 6c5e70cdb9
commit 5b94e2be46
4 changed files with 43 additions and 54 deletions

View File

@ -256,6 +256,7 @@ body {
&:before {
position: fixed;
z-index: 15;
}
}

View File

@ -43,7 +43,7 @@ export interface PageProps extends RendererProps {
}
export default class Page extends React.Component<PageProps> {
timer: NodeJS.Timer;
timer: number;
mounted: boolean;
static defaultProps = {
@ -406,13 +406,11 @@ export default class Page extends React.Component<PageProps> {
<div className={cx('Page-main')}>
{this.renderHeader()}
<div className={cx(`Page-body`, bodyClassName)}>
{store.loading
? render('spinner', {
type: 'spinner',
overlay: true,
size: 'lg',
})
: null}
{store.loading ? render('spinner', {
type: 'spinner',
overlay: true,
size: 'lg',
}) : null}
{store.error ? (
<Alert level="danger" showCloseButton onClose={store.clearMessage}>
@ -425,37 +423,29 @@ export default class Page extends React.Component<PageProps> {
</div>
</div>
{render(
'dialog',
{
...((store.action as Action) && ((store.action as Action).dialog as object)),
type: 'dialog',
},
{
key: 'dialog',
data: store.dialogData,
onConfirm: this.handleDialogConfirm,
onClose: this.handleDialogClose,
show: store.dialogOpen,
onAction: this.handleAction,
}
)}
{render('dialog', {
...((store.action as Action) && ((store.action as Action).dialog as object)),
type: 'dialog',
}, {
key: 'dialog',
data: store.dialogData,
onConfirm: this.handleDialogConfirm,
onClose: this.handleDialogClose,
show: store.dialogOpen,
onAction: this.handleAction,
})}
{render(
'drawer',
{
...((store.action as Action) && ((store.action as Action).drawer as object)),
type: 'drawer',
},
{
key: 'drawer',
data: store.drawerData,
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
show: store.drawerOpen,
onAction: this.handleAction,
}
)}
{render('drawer', {
...((store.action as Action) && ((store.action as Action).drawer as object)),
type: 'drawer',
}, {
key: 'drawer',
data: store.drawerData,
onConfirm: this.handleDrawerConfirm,
onClose: this.handleDrawerClose,
show: store.drawerOpen,
onAction: this.handleAction,
})}
</div>
);
}

View File

@ -25,7 +25,7 @@ export interface ServiceProps extends RendererProps {
};
}
export default class Service extends React.Component<ServiceProps> {
timer: NodeJS.Timeout;
timer: number;
mounted: boolean;
static defaultProps: Partial<ServiceProps> = {
@ -206,19 +206,17 @@ export default class Service extends React.Component<ServiceProps> {
{this.renderBody()}
{store.loading
? render(
'info',
{
type: 'spinner',
overlay: true,
},
{
key: 'info',
size: 'lg',
}
)
: null}
{store.loading ? render(
'info',
{
type: 'spinner',
overlay: true,
},
{
key: 'info',
size: 'lg',
}
) : null}
</div>
);
}

View File

@ -124,11 +124,11 @@ export const ServiceStore = iRendererStore
return;
}
markFetching(false);
if (root.isCancel(e)) {
return;
}
markFetching(false);
e.stack && console.error(e.stack);
root.notify('error', e.message || e);
}
@ -185,11 +185,11 @@ export const ServiceStore = iRendererStore
return;
}
markFetching(false);
if (root.isCancel(e)) {
return;
}
markFetching(false);
e.stack && console.error(e.stack);
root.notify('error', e.message || e);
}