1
+ import * as React from 'react' ;
1
2
import classnames from 'classnames' ;
2
3
import getScrollBarSize from 'rc-util/lib/getScrollBarSize' ;
3
4
import KeyCode from 'rc-util/lib/KeyCode' ;
4
- import * as React from 'react ' ;
5
+ import omit from 'omit.js ' ;
5
6
6
7
import { IDrawerChildProps } from './IDrawerPropTypes' ;
7
8
@@ -284,9 +285,8 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
284
285
} ;
285
286
286
287
private toggleScrollingToDrawerAndBody = ( right : number ) => {
287
- const { getOpenCount , getContainer, showMask, open } = this . props ;
288
+ const { getContainer, showMask, open } = this . props ;
288
289
const container = getContainer && getContainer ( ) ;
289
- const openCount = getOpenCount && getOpenCount ( ) ;
290
290
// 处理 body 滚动
291
291
if ( container && container . parentNode === document . body && showMask ) {
292
292
const eventArray = [ 'touchstart' ] ;
@@ -300,9 +300,6 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
300
300
if ( right ) {
301
301
this . addScrollingEffect ( right ) ;
302
302
}
303
- if ( openCount === 1 ) {
304
- document . body . style . overflow = 'hidden' ;
305
- }
306
303
document . body . style . touchAction = 'none' ;
307
304
// 手机禁滚
308
305
domArray . forEach ( ( item , i ) => {
@@ -317,10 +314,6 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
317
314
) ;
318
315
} ) ;
319
316
} else if ( this . getCurrentDrawerSome ( ) ) {
320
- // 没有弹框的状态下清除 overflow;
321
- if ( ! openCount ) {
322
- document . body . style . overflow = '' ;
323
- }
324
317
document . body . style . touchAction = '' ;
325
318
if ( right ) {
326
319
this . remScrollingEffect ( right ) ;
@@ -524,7 +517,7 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
524
517
} ) ;
525
518
return (
526
519
< div
527
- { ...props }
520
+ { ...omit ( props , [ 'switchScrollingEffect' ] ) }
528
521
tabIndex = { - 1 }
529
522
className = { wrapperClassName }
530
523
style = { style }
0 commit comments