refactor(core): add router

This commit is contained in:
qingwei.li 2017-02-18 11:41:33 +08:00 • committed by cinwell.li
commit 30da0d5d46
17 changed files with 316 additions and 88 deletions

View file

@ -1,5 +1,5 @@
import { isMobile } from '../util/env'
import { dom, on } from '../util/dom'
import { body, on } from '../util/dom'
import * as sidebar from './sidebar'
export function eventMixin (Docsify) {
@ -14,6 +14,6 @@ export function initEvent (vm) {
if (vm.config.coverpage) {
!isMobile && on('scroll', sidebar.sticky)
} else {
dom.body.classList.add('sticky')
body.classList.add('sticky')
}
}

View file

@ -1,10 +1,10 @@
import { isMobile } from '../util/env'
import { getNode, on, dom } from '../util/dom'
import { getNode, on, body } from '../util/dom'
/**
* Toggle button
*/
export function btn (el) {
const toggle = () => dom.body.classList.toggle('close')
const toggle = () => body.classList.toggle('close')
el = getNode(el)
on(el, 'click', toggle)