From 9af855921ea83a64d56a70e69bfebb422f3db5a2 Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Sun, 9 Jul 2017 10:48:41 +0800 Subject: [PATCH] fix: not found page --- src/core/fetch/index.js | 15 +++++++++++---- src/core/render/index.js | 4 ++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/core/fetch/index.js b/src/core/fetch/index.js index ceba3081..78481b59 100644 --- a/src/core/fetch/index.js +++ b/src/core/fetch/index.js @@ -28,17 +28,24 @@ export function fetchMixin (proto) { // Current page is html this.isHTML = /\.html$/g.test(path) - // Load main content - last.then((text, opt) => { - this._renderMain(text, opt) + const loadSideAndNav = () => { if (!loadSidebar) return cb() const fn = result => { this._renderSidebar(result); cb() } // Load sidebar loadNested(path, loadSidebar, fn, this, true) + } + + // Load main content + last.then((text, opt) => { + this._renderMain(text, opt) + loadSideAndNav() }, - _ => this._renderMain(null)) + _ => { + this._renderMain(null) + loadSideAndNav() + }) // Load nav loadNavbar && diff --git a/src/core/render/index.js b/src/core/render/index.js index 686f19e2..2145b285 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -117,6 +117,10 @@ export function renderMixin (proto) { } proto._renderMain = function (text, opt = {}) { + if (!text) { + return renderMain.call(this, text) + } + callHook(this, 'beforeEach', text, result => { let html = this.isHTML ? result : this.compiler.compile(result) if (opt.updatedAt) {