From 0933445e8960ca7d5d63c6286823fbac2c0c8f4b Mon Sep 17 00:00:00 2001 From: Romain Lenzotti Date: Sat, 3 Mar 2018 14:34:42 +0100 Subject: [PATCH] fix(navbar): Now Navbar isn't append to DOM when loadNavbar is falsy (#407) --- src/core/event/index.js | 5 ++++- src/core/render/index.js | 8 ++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/core/event/index.js b/src/core/event/index.js index dec4fcb36..79923fd8a 100644 --- a/src/core/event/index.js +++ b/src/core/event/index.js @@ -6,7 +6,10 @@ import { scrollIntoView } from './scroll' export function eventMixin (proto) { proto.$resetEvents = function () { scrollIntoView(this.route.path, this.route.query.id) - sidebar.getAndActive(this.router, 'nav') + + if (this.config.loadNavbar) { + sidebar.getAndActive(this.router, 'nav') + } } } diff --git a/src/core/render/index.js b/src/core/render/index.js index 1bea205a5..481ec98f4 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -117,7 +117,9 @@ export function renderMixin (proto) { proto._renderNav = function (text) { text && this._renderTo('nav', this.compiler.compile(text)) - getAndActive(this.router, 'nav') + if (this.config.loadNavbar) { + getAndActive(this.router, 'nav') + } } proto._renderMain = function (text, opt = {}, next) { @@ -238,7 +240,9 @@ export function initRender (vm) { } // Add nav - dom.before(navAppendToTarget, navEl) + if (config.loadNavbar) { + dom.before(navAppendToTarget, navEl) + } if (config.themeColor) { dom.$.head.appendChild(