preperation to run the code in nodejs
This commit is contained in:
parent
69ef489210
commit
fd86c727af
5 changed files with 694 additions and 4 deletions
|
|
@ -87,7 +87,10 @@ export function scrollActiveSidebar(router) {
|
|||
coverHeight = cover ? cover.offsetHeight : 0
|
||||
|
||||
const sidebar = dom.getNode('.sidebar')
|
||||
const lis = dom.findAll(sidebar, 'li')
|
||||
let lis = []
|
||||
if (sidebar != null) {
|
||||
lis = dom.findAll(sidebar, 'li')
|
||||
}
|
||||
|
||||
for (let i = 0, len = lis.length; i < len; i += 1) {
|
||||
const li = lis[i]
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ export function btn(el) {
|
|||
const toggle = _ => dom.body.classList.toggle('close')
|
||||
|
||||
el = dom.getNode(el)
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
dom.on(el, 'click', e => {
|
||||
e.stopPropagation()
|
||||
toggle()
|
||||
|
|
@ -24,7 +27,9 @@ export function btn(el) {
|
|||
|
||||
export function collapse(el) {
|
||||
el = dom.getNode(el)
|
||||
|
||||
if (el == null) {
|
||||
return
|
||||
}
|
||||
dom.on(el, 'click', ({target}) => {
|
||||
if (
|
||||
target.nodeName === 'A' &&
|
||||
|
|
@ -60,8 +65,10 @@ export function sticky() {
|
|||
*/
|
||||
export function getAndActive(router, el, isParent, autoTitle) {
|
||||
el = dom.getNode(el)
|
||||
|
||||
const links = dom.findAll(el, 'a')
|
||||
let links = []
|
||||
if (el != null) {
|
||||
links = dom.findAll(el, 'a')
|
||||
}
|
||||
const hash = decodeURI(router.toURL(router.getCurrentPath()))
|
||||
let target
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue