Commit cc38c418 by Wee

fix(hideRoute): fix protential reading style of null

parent 703aebff
...@@ -193,10 +193,9 @@ class Route extends React.Component { ...@@ -193,10 +193,9 @@ class Route extends React.Component {
// 隐藏 DOM 并保存 scroll // 隐藏 DOM 并保存 scroll
hideRoute() { hideRoute() {
const previousDisplayStyle = this.routeDom.style.display if (this.routeDom && this.routeDom.style.display !== 'none') {
if (this.routeDom && previousDisplayStyle !== 'none') {
this.saveScroll() this.saveScroll()
this._previousDisplayStyle = previousDisplayStyle this._previousDisplayStyle = this.routeDom.style.display
this.routeDom.style.display = 'none' this.routeDom.style.display = 'none'
} }
} }
......
{ {
"name": "react-live-route", "name": "react-live-route",
"version": "1.1.4", "version": "1.1.5",
"description": "A living route for react-router-v4", "description": "A living route for react-router-v4",
"repository": "fi3ework/react-live-route", "repository": "fi3ework/react-live-route",
"license": "MIT", "license": "MIT",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment