Fix scroll highlight when Vue exist
This commit is contained in:
parent
9ac8293c0a
commit
b9aeb4a922
3 changed files with 10 additions and 3 deletions
2
app.js
2
app.js
|
|
@ -4,7 +4,7 @@ var fs = require('fs')
|
|||
|
||||
http.createServer(function (req, res) {
|
||||
serveStatic('.')(req, res, function () {
|
||||
res.writeHead(200, { 'Content-Type': 'text/html' })
|
||||
res.writeHead(404, { 'Content-Type': 'text/html' })
|
||||
res.end(fs.readFileSync('dev.html'))
|
||||
})
|
||||
}).listen(3000, '0.0.0.0')
|
||||
|
|
|
|||
2
dev.html
2
dev.html
|
|
@ -8,5 +8,7 @@
|
|||
<body class="">
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
<script src=//unpkg.com/vue></script>
|
||||
<script src=//unpkg.com/vuep></script>
|
||||
<script src="/lib/docsify.js" data-repo="qingwei-li/docsify" data-auto2top data-sidebar-toggle data-router></script>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -83,7 +83,10 @@ export function renderArticle (content) {
|
|||
renderSidebar.rendered = false
|
||||
renderNavbar.rendered = false
|
||||
|
||||
if (content && typeof Vue !== 'undefined' && typeof Vuep !== 'undefined') new Vue({ el: 'main' }) // eslint-disable-line
|
||||
if (content && typeof Vue !== 'undefined' && typeof Vuep !== 'undefined') {
|
||||
const vm = new Vue({ el: 'main' }) // eslint-disable-line
|
||||
vm.$nextTick(_ => scrollActiveSidebar())
|
||||
}
|
||||
if (OPTIONS.auto2top) scroll2Top()
|
||||
}
|
||||
|
||||
|
|
@ -118,7 +121,9 @@ export function renderSidebar (content) {
|
|||
if (CACHE.sidebar && CACHE.sidebar === content) return
|
||||
CACHE.sidebar = content
|
||||
renderTo('aside.sidebar', content)
|
||||
if (isToc) scrollActiveSidebar()
|
||||
if (isToc) {
|
||||
scrollActiveSidebar()
|
||||
}
|
||||
toc = []
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue