diff --git a/src/core/init/lifecycle.js b/src/core/init/lifecycle.js index 37262c0d7..d8749619d 100644 --- a/src/core/init/lifecycle.js +++ b/src/core/init/lifecycle.js @@ -19,23 +19,22 @@ export function initLifecycle (vm) { } export function callHook (vm, hook, data, next = noop) { - let newData = data const queue = vm._hooks[hook] const step = function (index) { const hook = queue[index] if (index >= queue.length) { - next(newData) + next(data) } else { if (typeof hook === 'function') { if (hook.length === 2) { hook(data, result => { - newData = result + data = result step(index + 1) }) } else { const result = hook(data) - newData = result !== undefined ? result : newData + data = result !== undefined ? result : data step(index + 1) } } else { diff --git a/src/plugins/front-matter/index.js b/src/plugins/front-matter/index.js index 459fac00b..b2b0efad5 100644 --- a/src/plugins/front-matter/index.js +++ b/src/plugins/front-matter/index.js @@ -10,4 +10,4 @@ const install = function (hook, vm) { }) } -window.$docsify.plugins = [].concat(install, window.$docsify.plugins) +$docsify.plugins = [].concat(install, $docsify.plugins)