mirror of https://github.com/IoTcat/docsify.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
674 B
26 lines
674 B
import {isMobile} from '../util/env' |
|
import {body, on} from '../util/dom' |
|
import * as sidebar from './sidebar' |
|
import {scrollIntoView} from './scroll' |
|
|
|
export function eventMixin(proto) { |
|
proto.$resetEvents = function () { |
|
scrollIntoView(this.route.path, this.route.query.id) |
|
|
|
if (this.config.loadNavbar) { |
|
sidebar.getAndActive(this.router, 'nav') |
|
} |
|
} |
|
} |
|
|
|
export function initEvent(vm) { |
|
// Bind toggle button |
|
sidebar.btn('button.sidebar-toggle', vm.router) |
|
sidebar.collapse('.sidebar', vm.router) |
|
// Bind sticky effect |
|
if (vm.config.coverpage) { |
|
!isMobile && on('scroll', sidebar.sticky) |
|
} else { |
|
body.classList.add('sticky') |
|
} |
|
}
|
|
|