Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

地址栏手动更改路由(pathname),侧边栏没有匹配高亮 #201

Closed
jiangbo2015 opened this issue Apr 21, 2017 · 2 comments
Closed
Labels

Comments

@jiangbo2015
Copy link

内容跟着换了,侧边栏没有匹配高亮效果,还是上一个路由的高亮

@zuiidea zuiidea added the bug label Apr 21, 2017
@jiangbo2015
Copy link
Author

jiangbo2015 commented Apr 21, 2017

componentWillMount() {
        let { keys, values, entries } = Object
        const pathname = this.props.location.pathname
        const _current = pathname === '/' ? introduce : pathname.substr(0, 1) === '/' ? pathname.substr(1) : pathname
        const hasKeys = SideMenus.filter(value => {
            return value.key !== _current && value.groups
        })
        let findKyes = []
        if (hasKeys.length > 0) {
            findKyes = hasKeys.filter(value => {
                for (let value of values(value.groups)) {
                    return value.key === _current
                }
            })
        }
        let _openKeys = []
        findKyes.length > 0 ? _openKeys.push(findKyes[0].key) : _openKeys.push('introduce')
        this.setState({ current: _current, openKeys: _openKeys });
    }

本人是这么处理的,不太优雅

@zuiidea
Copy link
Owner

zuiidea commented Apr 25, 2017

@zuiidea zuiidea closed this as completed Apr 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants