Skip to content

Commit c620515

Browse files
committed
fix dom is null scroll
1 parent e6b035f commit c620515

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
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-menu",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "drawer menu animation component for react",
55
"keywords": [
66
"react",

src/Drawer.jsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ class Drawer extends React.PureComponent {
175175

176176
removeScroll = (e) => {
177177
const dom = e.target;
178-
if (dom.className === `${this.props.className}-bg` || this.getIsButtonDom(dom)) {
178+
const scrollDom = this.getScollDom(dom);
179+
if (dom.className === `${this.props.className}-bg` || this.getIsButtonDom(dom) || !scrollDom) {
179180
e.preventDefault();
180181
e.returnValue = false;
181182
return;
@@ -192,10 +193,6 @@ class Drawer extends React.PureComponent {
192193
y = this.mousePos.y - touches.pageY;
193194
x = this.mousePos.x - touches.pageX;
194195
}
195-
const scrollDom = this.getScollDom(dom);
196-
if (!scrollDom) {
197-
return;
198-
}
199196
// 竖向
200197
const scrollTop = scrollDom.scrollTop;
201198
const height = scrollDom.clientHeight;

0 commit comments

Comments
 (0)