fix: docsify-updated is undefined

This commit is contained in:
qingwei.li 2017-05-19 08:36:45 +08:00
commit b2b474264f
No known key found for this signature in database
GPG key ID: B6DDC2F7AE80B2F4
2 changed files with 6 additions and 3 deletions

View file

@ -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')
}
}

View file

@ -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))
})