refactor(core): add render
This commit is contained in:
parent
aad62b65f5
commit
8bee8f0213
20 changed files with 232 additions and 102 deletions
|
|
@ -9,7 +9,7 @@ import { isFn } from '../util/core'
|
|||
export function initMixin (Docsify) {
|
||||
Docsify.prototype._init = function () {
|
||||
const vm = this
|
||||
vm._config = config || {}
|
||||
vm.config = config || {}
|
||||
|
||||
initLifecycle(vm) // Init hooks
|
||||
initPlugin(vm) // Install plugins
|
||||
|
|
@ -23,5 +23,5 @@ export function initMixin (Docsify) {
|
|||
}
|
||||
|
||||
function initPlugin (vm) {
|
||||
[].concat(vm.config.plugins).forEach(fn => isFn(fn) && fn(vm.bindHook))
|
||||
[].concat(vm.config.plugins).forEach(fn => isFn(fn) && fn(vm._lifecycle, vm))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ export function initLifecycle (vm) {
|
|||
const hooks = ['init', 'beforeEach', 'afterEach', 'doneEach', 'ready']
|
||||
|
||||
vm._hooks = {}
|
||||
vm.bindHook = {}
|
||||
vm._lifecycle = {}
|
||||
hooks.forEach(hook => {
|
||||
const arr = vm._hooks[hook] = []
|
||||
vm._bindHook[hook] = fn => arr.push(fn)
|
||||
vm._lifecycle[hook] = fn => arr.push(fn)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue