Skip to content

Commit 3ec7c89

Browse files
committed
fix initialize the Vue instance
1 parent 89f0b1f commit 3ec7c89

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Diff for: src/render.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,13 @@ export function renderArticle (content) {
112112
document.body.querySelectorAll('article>script'))
113113
.filter(script => !/template/.test(script.type)
114114
)[0]
115+
const code = script ? script.innerText.trim() : null
115116

116-
CACHE.vm = script
117-
? new Function(`return ${script.innerText.trim()}`)()
117+
script && script.remove()
118+
CACHE.vm = code
119+
? new Function(`return ${code}`)()
118120
: new Vue({ el: 'main' }) // eslint-disable-line
119121
CACHE.vm && CACHE.vm.$nextTick(_ => event.scrollActiveSidebar())
120-
script && script.remove()
121122
}
122123
if (OPTIONS.auto2top) setTimeout(() => event.scroll2Top(OPTIONS.auto2top), 0)
123124
}

0 commit comments

Comments
 (0)