Skip to content

Commit bf2b2a0

Browse files
committed
修复在Link多的情况下(大于10个),页面滚动卡顿的问题
1 parent 3df1147 commit bf2b2a0

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/ScrollLink.jsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,11 @@ class ScrollLink extends React.Component {
107107
this.props.onFocus.call(this, obj);
108108
this.props.onFocus.only = true;
109109
}
110-
this.setState({
111-
active: true,
112-
});
110+
if (this.state.active !== true) {
111+
this.setState({
112+
active: true,
113+
});
114+
}
113115
} else {
114116
if (this.props.onFocus.only) {
115117
const obj = {
@@ -119,9 +121,11 @@ class ScrollLink extends React.Component {
119121
this.props.onBlur.call(this, obj);
120122
}
121123
this.props.onFocus.only = false;
122-
this.setState({
123-
active: false,
124-
});
124+
if (this.state.active !== false) {
125+
this.setState({
126+
active: false,
127+
});
128+
}
125129
}
126130
}
127131

0 commit comments

Comments
 (0)