use antd component react frame single page router my page column jumps want to achieve the left menu bar navigation index also changes to the corresponding page options, how do you achieve this function! Just give me some ideas picture description
use antd component react frame single page router my page column jumps want to achieve the left menu bar navigation index also changes to the corresponding page options, how do you achieve this function! Just give me some ideas picture description
judge the selected key based on url
render() {
const pathName = hashHistory.getCurrentLocation().pathname;
return (
<Menu selectedKeys={[pathName]} >
...
</Menu>
);
}
if you use the Menu component of antd, you already have this feature.
have brothers solved it? Share!
directly gives you a Demo. DvaInitial , and the menu is implemented using antd's menu.
there is an idea that, if it is antd, your menu bar Sider component should have a method to set selectedKeys according to the time you click, so when you jump or move forward or backward within the page, you can call the method to set selectedKeys in the componentWillReceiveProps status method to make the menu highlight correspond to the jump on the page
.Previous: The address of the nginx local server agent cannot be accessed by the mobile phone.
Next: Ask for help: forget the server administrator password and cannot log in using remote Desktop