diff --git a/packages/amis-ui/scss/components/_spinner.scss b/packages/amis-ui/scss/components/_spinner.scss index 696f4c9d6c8..f7d0fd7ef67 100644 --- a/packages/amis-ui/scss/components/_spinner.scss +++ b/packages/amis-ui/scss/components/_spinner.scss @@ -30,6 +30,10 @@ opacity: 1; } + &.ing { + opacity: 0; + } + .#{$ns}Spinner-icon { width: var(--Spinner-width); height: var(--Spinner-height); diff --git a/packages/amis-ui/src/components/Spinner.tsx b/packages/amis-ui/src/components/Spinner.tsx index 6d48183eb09..eab79166d88 100644 --- a/packages/amis-ui/src/components/Spinner.tsx +++ b/packages/amis-ui/src/components/Spinner.tsx @@ -17,7 +17,7 @@ const fadeStyles: { [propName: string]: string; } = { [ENTERED]: 'in', - [ENTERING]: 'in' + [ENTERING]: 'ing' }; // Spinner Props @@ -199,7 +199,11 @@ export class Spinner extends React.Component< // 定义了挂载位置时只能使用默认icon const icon = loadingConfig?.root ? undefined : iconConfig; const isCustomIcon = icon && React.isValidElement(icon); - const timeout = {enter: delay, exit: 0}; + const timeout = { + appear: delay, + enter: delay, + exit: 0 + }; const showOverlay = loadingConfig?.root || overlay; @@ -213,6 +217,7 @@ export class Spinner extends React.Component< unmountOnExit in={this.state.spinning} timeout={timeout} + appear={this.state.spinning} > {(status: string) => { return ( diff --git a/packages/amis/__tests__/event-action/__snapshots__/drawer.test.tsx.snap b/packages/amis/__tests__/event-action/__snapshots__/drawer.test.tsx.snap index b19a495ca4f..86e4247d873 100644 --- a/packages/amis/__tests__/event-action/__snapshots__/drawer.test.tsx.snap +++ b/packages/amis/__tests__/event-action/__snapshots__/drawer.test.tsx.snap @@ -64,10 +64,10 @@ exports[`EventAction:drawer 1`] = ` class="cxd-Drawer-body" >