From 948e641c58f4daa6a6f29211ab70dba4c275e128 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Wed, 11 Sep 2019 14:29:11 +0800 Subject: [PATCH] previousPathName --- public/react/src/modules/courses/Index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/Index.js b/public/react/src/modules/courses/Index.js index 716a3583c..f8f6820f5 100644 --- a/public/react/src/modules/courses/Index.js +++ b/public/react/src/modules/courses/Index.js @@ -296,10 +296,11 @@ class CoursesIndex extends Component{ componentDidMount(){ // this.updataleftNav() - this.historyArray = [] + this.historyArray = [location.pathname]; + this.props.history.listen( location => { - console.log(location) - this.historyArray.unshift(location.pathname) + console.log(location); + this.historyArray.unshift(location.pathname); this.historyArray.length = 2; //Do your stuff here });