fix site subnav

pull/165/head
tjz 7 years ago
parent a2d818f23d
commit f100f0deb3

@ -40,7 +40,7 @@ export default {
currentSubMenu.forEach(({ cnTitle, usTitle, id }) => { currentSubMenu.forEach(({ cnTitle, usTitle, id }) => {
const title = isCN ? cnTitle : usTitle const title = isCN ? cnTitle : usTitle
const className = window.location.hash === `#${id}` ? 'current' : '' const className = window.location.hash === `#${id}` ? 'current' : ''
lis.push(<li title={title} key={id}><a href={`#${id}`} class={className}>{title}</a></li>) lis.push(<li title={title}><a href={`#${id}`} class={className}>{title}</a></li>)
}) })
return ( return (
<a-affix> <a-affix>

@ -53,11 +53,11 @@ export default {
`not have usTitle`, `not have usTitle`,
) )
} }
let id = ['components', name.replace('-cn', ''), 'demo', ...usTitle.split(' ')].join('-').toLowerCase() const id = ['components', name.replace('-cn', ''), 'demo', ...usTitle.split(' ')].join('-').toLowerCase()
if (this._store.store) { if (this._store.store) {
const { currentSubMenu } = this._store.store.getState() const { currentSubMenu } = this._store.store.getState()
id = `${id}-${currentSubMenu.length + 1}` // id = `${id}-${currentSubMenu.length + 1}`
this._store.store.setState({ currentSubMenu: [...currentSubMenu, { cnTitle, usTitle, id }] }) this._store.store.setState({ currentSubMenu: [...currentSubMenu, { cnTitle, usTitle, id }] })
} }
return { return {

Loading…
Cancel
Save