allow the user's $docsify config to be a function that receives as input the Docsify instance

This commit is contained in:
Joe Pea 2020-05-21 23:36:18 -07:00
parent b2e6123980
commit f72bf4cc9a
2 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import { merge, hyphenate, isPrimitive, hasOwn } from './util/core';
const currentScript = document.currentScript;
export default function() {
export default function(vm) {
const config = merge(
{
el: '#app',
@ -35,7 +35,9 @@ export default function() {
relativePath: false,
topMargin: 0,
},
window.$docsify
typeof window.$docsify === 'function'
? window.$docsify(vm)
: window.$docsify
);
const script =

View File

@ -9,7 +9,7 @@ import { initLifecycle, callHook } from './lifecycle';
export function initMixin(proto) {
proto._init = function() {
const vm = this;
vm.config = config();
vm.config = config(vm);
initLifecycle(vm); // Init hooks
initPlugin(vm); // Install plugins