fix initialize the Vue instance
This commit is contained in:
parent
89f0b1fcbd
commit
3ec7c89bbb
1 changed files with 4 additions and 3 deletions
|
|
@ -112,12 +112,13 @@ export function renderArticle (content) {
|
||||||
document.body.querySelectorAll('article>script'))
|
document.body.querySelectorAll('article>script'))
|
||||||
.filter(script => !/template/.test(script.type)
|
.filter(script => !/template/.test(script.type)
|
||||||
)[0]
|
)[0]
|
||||||
|
const code = script ? script.innerText.trim() : null
|
||||||
|
|
||||||
CACHE.vm = script
|
script && script.remove()
|
||||||
? new Function(`return ${script.innerText.trim()}`)()
|
CACHE.vm = code
|
||||||
|
? new Function(`return ${code}`)()
|
||||||
: new Vue({ el: 'main' }) // eslint-disable-line
|
: new Vue({ el: 'main' }) // eslint-disable-line
|
||||||
CACHE.vm && CACHE.vm.$nextTick(_ => event.scrollActiveSidebar())
|
CACHE.vm && CACHE.vm.$nextTick(_ => event.scrollActiveSidebar())
|
||||||
script && script.remove()
|
|
||||||
}
|
}
|
||||||
if (OPTIONS.auto2top) setTimeout(() => event.scroll2Top(OPTIONS.auto2top), 0)
|
if (OPTIONS.auto2top) setTimeout(() => event.scroll2Top(OPTIONS.auto2top), 0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue