fix: sidebar highlight

This commit is contained in:
qingwei.li 2017-09-01 15:50:53 +08:00
commit f82f41900e
2 changed files with 2646 additions and 406 deletions

3048
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -86,7 +86,7 @@ export function scrollActiveSidebar (router) {
href = router.parse(href).query.id href = router.parse(href).query.id
} }
nav[decodeURIComponent(href)] = li if (href) nav[decodeURIComponent(href)] = li
} }
dom.off('scroll', highlight) dom.off('scroll', highlight)
@ -96,6 +96,8 @@ export function scrollActiveSidebar (router) {
} }
export function scrollIntoView (id) { export function scrollIntoView (id) {
if (!id) return
const section = dom.find('#' + id) const section = dom.find('#' + id)
section && scrollTo(section) section && scrollTo(section)