init config by window.

This commit is contained in:
qingwei.li 2017-01-04 20:47:55 +08:00
commit 897283418a
3 changed files with 53 additions and 39 deletions

View file

@ -1,8 +1,8 @@
import { load, camel2kebab, isNil, getRoute } from './util'
import { load, camel2kebab, isNil, getRoute, merge } from './util'
import { scrollIntoView, activeLink } from './event'
import * as render from './render'
const OPTIONS = {
const OPTIONS = merge({
el: '#app',
repo: '',
maxLevel: 6,
@ -16,7 +16,7 @@ const OPTIONS = {
coverpage: '',
basePath: '',
auto2top: false
}
}, window.$docsify)
const script = document.currentScript || [].slice.call(document.getElementsByTagName('script')).pop()
// load configuration for script attribute
@ -32,7 +32,7 @@ if (script) {
}
// load options
render.config(OPTIONS)
render.init(OPTIONS)
let cacheRoute = null
let cacheXhr = null