Skip to content

Commit fe99367

Browse files
committed
fix body no scroll
1 parent 5f59c52 commit fe99367

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rc-drawer",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "drawer component for react",
55
"keywords": [
66
"react",

src/DrawerChild.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,9 @@ class DrawerChild extends React.Component<IDrawerChildProps, IState> {
214214
) => {
215215
const { placement, levelMove, duration, ease, onChange, showMask } = this.props;
216216
if (!windowIsUndefined) {
217-
const right = getScrollBarSize(true);// router 切换时可能会导至页面失去滚动条,所以需要时时获取。
217+
const right = document.body.scrollHeight >
218+
(window.innerHeight || document.documentElement.clientHeight) &&
219+
window.innerWidth > document.body.offsetWidth ? getScrollBarSize(true) : 0;// router 切换时可能会导至页面失去滚动条,所以需要时时获取。
218220
this.levelDom.forEach(dom => {
219221
dom.style.transition = `transform ${duration} ${ease}`;
220222
addEventListener(dom, transitionEnd, this.transitionEnd);

0 commit comments

Comments
 (0)