hi @vifird
非常感谢你们团队的工作,keeper帮了我的大忙! 现在我碰到一个问题,请教一下。
问题:
在退出登录后重新登录或刷新界面重新登录,导航栏停留在上次退出时的导航地址, 而使用Control.path获取到的地址始终为"/"


目标效果:
导航菜单的当前选定项(Menu->defaultSelectedKeys)和当前页面/URL是对应关系。短时间退出->重新登陆,仍然应该在当前操作页面延续工作.
相关代码:
console.log(Control.path);
return(
<React.Fragment>
{
this.props.commonVariable.IsLoginStatus ? (
<Layout style={{scroll: 'hidden', height: '100%'}}>
<BackTop>
</BackTop>
<Header>
<Menu
theme="dark"
mode="horizontal"
defaultSelectedKeys={['1']}
style={{lineHeight: '64px'}}
>
{console.log(Control.path)}
<Menu.Item key="1" onClick={() => {
Control.go("/");
//if (this.props.location.pathname !== "/") this.props.history.push('/');
}}>
<Icon type="search"/> 检索
</Menu.Item>
<Menu.Item key="2" onClick={() => {
//this.props.history.push('/industry')
Control.go("/industry");
}}>
<Icon type="project"/> 课题
</Menu.Item>
<Menu.Item key="3">
<Icon type="setting"/> 设置</Menu.Item>
<Menu.Item key="4" onClick={() => {
//this.props.history.push('/scandb')
Control.go("/scandb");
}}>
<Icon type="global"/> 全库
</Menu.Item>
<div style={{display: 'inline-block', float: 'right'}}>
<TaskStatus buttonStyle={{marginRight: '20px'}}/>
<Dropdown overlay={userDownloadList} handleClick={this._userProfileClick}>
<a className="ant-dropdown-link" href="#">
{`Hello, ${this.props.commonVariable._USERINFO.userName}`}
</a>
</Dropdown>
</div>
</Menu>
</Header>
<Layout>
<Content style={{overflow: 'hidden', flex: '1 1 0', backgroundColor: 'white'}}>
<HashRouter>
<div>
<Route cache={'parent'} path='/' component={JLSearchResultTileData} key={'searchresult'} />
<Route cache={'parent'} path='/industrydetail/:industryID' component={JLViewIndustry} key={'JLViewIndustry'}/>
<Route cache={'root'} path='/newindustry' component={JLNewIndustry} key={'JLNewIndustry'}/>
</div>
</HashRouter>
</Content>
</Layout>
</Layout>
) :
<div>
<header className={"headerbackGround"}>
<div style={{zIndex: '999'}}>
<JLLoginPage/>
</div>
</header>
</div>
}
</React.Fragment>
);
hi @vifird


非常感谢你们团队的工作,keeper帮了我的大忙! 现在我碰到一个问题,请教一下。
问题:
在退出登录后重新登录或刷新界面重新登录,导航栏停留在上次退出时的导航地址, 而使用Control.path获取到的地址始终为"/"
目标效果:
导航菜单的当前选定项(Menu->defaultSelectedKeys)和当前页面/URL是对应关系。短时间退出->重新登陆,仍然应该在当前操作页面延续工作.
相关代码: