ant-design/components/spin/index.zh-CN.md
Rafael Martins cc223a102c
feat(spin): Adds fullscreen property to <Spin /> component (#44986)
* feat: start the implementation of the fullscreen prop in Spin

* docs: change main spin demo

* docs: enhance demo

* test: update snapshot

* fix: address pr comments

* fix: use logical property on fullscreen class

* fix: address pr review

* feat: Added background color token

* fix: remove onClick and change demo

* feat: change spin to white when fullcreen

also use the bgmask as background, removing the bgColor token

* fix: unused import

* test: update snapshot

* Update components/spin/style/index.tsx

Signed-off-by: lijianan <574980606@qq.com>

* fix: use white color from token

* fix: not needed interpolation and version

* fix: address pr review

* fix: tip prop was not working

* test: cover tip & fullscreen case

* fix: addrress pr coments

---------

Signed-off-by: lijianan <574980606@qq.com>
Co-authored-by: lijianan <574980606@qq.com>
Co-authored-by: MadCcc <1075746765@qq.com>
2023-10-19 13:47:48 +08:00

53 lines
1.8 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
category: Components
group: 反馈
title: Spin
subtitle: 加载中
cover: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*5mC5TomY4B0AAAAAAAAAAAAADrJ8AQ/original
coverDark: https://mdn.alipayobjects.com/huamei_7uahnr/afts/img/A*i43_ToFrL8YAAAAAAAAAAAAADrJ8AQ/original
demo:
cols: 2
---
用于页面和区块的加载中状态。
## 何时使用
页面局部处于等待异步数据或正在渲染过程时,合适的加载动效会有效缓解用户的焦虑。
## 代码演示
<!-- prettier-ignore -->
<code src="./demo/basic.tsx">基本用法</code>
<code src="./demo/size.tsx">各种大小</code>
<code src="./demo/inside.tsx">容器</code>
<code src="./demo/nested.tsx">卡片加载中</code>
<code src="./demo/tip.tsx">自定义描述文案</code>
<code src="./demo/delayAndDebounce.tsx">延迟</code>
<code src="./demo/custom-indicator.tsx">自定义指示符</code>
<code src="./demo/fullscreen.tsx">全屏</code>
## API
通用属性参考:[通用属性](/docs/react/common-props)
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| delay | 延迟显示加载效果的时间(防止闪烁) | number (毫秒) | - |
| indicator | 加载指示符 | ReactNode | - |
| size | 组件大小,可选值为 `small` `default` `large` | string | `default` |
| spinning | 是否为加载中状态 | boolean | true |
| tip | 当作为包裹元素时,可以自定义描述文案 | ReactNode | - |
| wrapperClassName | 包装器的类属性 | string | - |
| fullscreen | 显示带有 `Spin` 组件的背景 | boolean | false | 5.11.0 |
### 静态方法
- `Spin.setDefaultIndicator(indicator: ReactNode)`
你可以自定义全局默认 Spin 的元素。
## 主题变量Design Token
<ComponentTokenTable component="Spin"></ComponentTokenTable>