Commit 7afe8d8f by zhanghaozhe

智能选课

parent 95f355c3
......@@ -69,8 +69,7 @@ class App extends Component {
this.getUser()
this.utm()
const {history, location} = this.props
this.records.push(location)
const {history} = this.props
this.setNavigationRecord(this.props.location, this.props.history.action)
this.setPreviousLocation()
......@@ -142,13 +141,12 @@ class App extends Component {
const {pathname, search, hash} = location
let isLastRecord = location.pathname === (this.records.length && this.records[this.records.length - 1].pathname)
let needHistoryMutation = location.pathname !== this.previousLocation.pathname
switch (action) {
case 'POP':
if (needHistoryMutation) {
this.firstLoad ? this.records.push({pathname, search, hash}) : this.records.pop()
} else {
this.records[this.records.length - 1] = location
this.records.length ? (this.records[this.records.length - 1] = location) : this.records = [location]
}
break
case 'REPLACE':
......@@ -160,8 +158,10 @@ class App extends Component {
location.state && location.state.records
? (location.state.records = this.records)
: location.state ? location.state = {...location.state, records: this.records}
: (location.state = {records: this.records})
: location.state ? location.state = {
...location.state,
records: this.records,
} : (location.state = {records: this.records})
}
......
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