From b2b474264f3a618d370a632713258e98278c732e Mon Sep 17 00:00:00 2001 From: "qingwei.li" Date: Fri, 19 May 2017 08:36:45 +0800 Subject: [PATCH] fix: docsify-updated is undefined --- src/core/fetch/ajax.js | 3 ++- src/core/render/index.js | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/fetch/ajax.js b/src/core/fetch/ajax.js index 1824cc459..d311f46b7 100644 --- a/src/core/fetch/ajax.js +++ b/src/core/fetch/ajax.js @@ -45,7 +45,8 @@ export function get (url, hasBar = false) { const result = cache[url] = { content: target.response, opt: { - updatedAt: xhr.getResponseHeader('last-modified') + updatedAt: xhr.getResponseHeader('last-modified') || + xhr.getResponseHeader('expires') } } diff --git a/src/core/render/index.js b/src/core/render/index.js index c4bd4201c..6c5581e4d 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -108,10 +108,12 @@ export function renderMixin (proto) { getAndActive('nav') } - proto._renderMain = function (text, opt) { + proto._renderMain = function (text, opt = {}) { callHook(this, 'beforeEach', text, result => { let html = this.isHTML ? result : markdown(result) - html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated) + if (opt.updatedAt) { + html = formatUpdated(html, opt.updatedAt, this.config.formatUpdated) + } callHook(this, 'afterEach', html, text => renderMain.call(this, text)) })