From 56e8a75fec1af89b5936fa1070e5dea159411926 Mon Sep 17 00:00:00 2001 From: Mary Ma Date: Tue, 22 Sep 2020 18:38:17 +0800 Subject: [PATCH] feat: keep the pre value if no current active --- src/js/lib/scrollspy.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/lib/scrollspy.js b/src/js/lib/scrollspy.js index 97d4853..385d1da 100644 --- a/src/js/lib/scrollspy.js +++ b/src/js/lib/scrollspy.js @@ -190,6 +190,9 @@ export default class Scrollspy extends React.Component { _spy (targets) { const elemensViewState = this._getElemsViewState(targets) + if (elemensViewState.viewStatusList.indexOf(true) < 0) { + return; + } const currentStatuses = this.state.inViewState this.setState({