Skip to content

Commit c0f7592

Browse files
committed
feat(Loading): add disableScroll
1 parent 7c0f061 commit c0f7592

File tree

4 files changed

+31
-33
lines changed

4 files changed

+31
-33
lines changed

docs/loading/index.en-us.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,5 @@ if you want `wrap all the element`, please use `<Loading style={{display: 'block
3232
| indicator | custom animation | any | - |
3333
| color | animation color | String | - |
3434
| fullScreen | fullscreen display | Boolean | - |
35+
| disableScroll | whether to disable page scrolling, only works when fullScreen is true | Boolean | false |
3536
| children | children elements | any | - |

docs/loading/index.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ Loading 默认使用 `display='inline-block'` 布局的方式包裹内部元素
2323

2424
### Loading
2525

26-
| 参数 | 说明 | 类型 | 默认值 |
27-
| ---------- | ---------------------------------------------------------------- | ------- | -------- |
28-
| tip | 自定义内容 | any | - |
29-
| size | 设置动画尺寸<br><br>**可选值**:<br>'large'(大号)<br>'medium'(中号) | Enum | 'large' |
30-
| tipAlign | 自定义内容位置<br><br>**可选值**:<br>'right'(出现在动画右边)<br>'bottom'(出现在动画下面) | Enum | 'bottom' |
31-
| visible | loading 状态, 默认 true | Boolean | true |
32-
| indicator | 自定义动画 | any | - |
33-
| color | 动画颜色 | String | - |
34-
| fullScreen | 全屏展示 | Boolean | - |
35-
| children | 子元素 | any | - |
36-
| inline | should loader be displayed inline | Boolean | true |
26+
| 参数 | 说明 | 类型 | 默认值 |
27+
| ------------- | ---------------------------------------------------------------- | ------- | -------- |
28+
| tip | 自定义内容 | any | - |
29+
| size | 设置动画尺寸<br><br>**可选值**:<br>'large'(大号)<br>'medium'(中号) | Enum | 'large' |
30+
| tipAlign | 自定义内容位置<br><br>**可选值**:<br>'right'(出现在动画右边)<br>'bottom'(出现在动画下面) | Enum | 'bottom' |
31+
| visible | loading 状态, 默认 true | Boolean | true |
32+
| indicator | 自定义动画 | any | - |
33+
| color | 动画颜色 | String | - |
34+
| fullScreen | 全屏展示 | Boolean | - |
35+
| disableScroll | 是否禁用滚动,仅在 fullScreen 模式下生效 | Boolean | false |
36+
| children | 子元素 | any | - |
37+
| inline | should loader be displayed inline | Boolean | true |

src/loading/index.jsx

+14-21
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class Loading extends React.Component {
5454
* 全屏展示
5555
*/
5656
fullScreen: PropTypes.bool,
57+
/**
58+
* 是否禁用滚动,仅在 fullScreen 模式下生效
59+
*/
60+
disableScroll: PropTypes.bool,
5761
/**
5862
* 子元素
5963
*/
@@ -73,6 +77,7 @@ class Loading extends React.Component {
7377
tipAlign: 'bottom',
7478
size: 'large',
7579
inline: true,
80+
disableScroll: false,
7681
};
7782

7883
render() {
@@ -86,6 +91,7 @@ class Loading extends React.Component {
8691
color,
8792
prefix,
8893
fullScreen,
94+
disableScroll,
8995
onVisibleChange,
9096
tipAlign,
9197
size,
@@ -142,45 +148,32 @@ class Loading extends React.Component {
142148
key="overlay"
143149
hasMask
144150
align="cc cc"
151+
disableScroll={disableScroll}
145152
{...others}
146153
className={className}
147154
style={style}
148155
visible={visible}
149156
onRequestClose={onVisibleChange}
150157
>
151158
<div className={tipCls}>
152-
<div className={`${prefix}loading-indicator`}>
153-
{indicatorDom}
154-
</div>
155-
<div className={`${prefix}loading-tip-content`}>
156-
{tip}
157-
</div>
159+
<div className={`${prefix}loading-indicator`}>{indicatorDom}</div>
160+
<div className={`${prefix}loading-tip-content`}>{tip}</div>
158161
{/* 由于撑开问题 使用同样的两个DOM */}
159-
<div className={`${prefix}loading-tip-placeholder`}>
160-
{tip}
161-
</div>
162+
<div className={`${prefix}loading-tip-placeholder`}>{tip}</div>
162163
</div>
163164
</Overlay>,
164165
]
165166
) : (
166167
<div className={loadingCls} style={style} {...others}>
167168
{visible ? (
168169
<div className={tipCls}>
169-
<div className={`${prefix}loading-indicator`}>
170-
{indicatorDom}
171-
</div>
172-
<div className={`${prefix}loading-tip-content`}>
173-
{tip}
174-
</div>
175-
<div className={`${prefix}loading-tip-placeholder`}>
176-
{tip}
177-
</div>
170+
<div className={`${prefix}loading-indicator`}>{indicatorDom}</div>
171+
<div className={`${prefix}loading-tip-content`}>{tip}</div>
172+
<div className={`${prefix}loading-tip-placeholder`}>{tip}</div>
178173
</div>
179174
) : null}
180175
<div className={contentCls}>
181-
{visible ? (
182-
<div className={`${prefix}loading-masker`} />
183-
) : null}
176+
{visible ? <div className={`${prefix}loading-masker`} /> : null}
184177
{children}
185178
</div>
186179
</div>

types/loading/index.d.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ export interface LoadingProps extends React.HTMLAttributes<HTMLElement>, CommonP
5353
* 全屏展示
5454
*/
5555
fullScreen?: boolean;
56-
56+
/**
57+
* 是否禁用滚动,仅在 fullScreen 模式下生效
58+
*/
59+
disableScroll?: boolean;
5760
/**
5861
* 子元素
5962
*/

0 commit comments

Comments
 (0)