parent
b8100c0755
commit
9220523a40
11 changed files with 67 additions and 28 deletions
|
|
@ -17,7 +17,8 @@ const config = merge({
|
|||
autoHeader: false,
|
||||
executeScript: null,
|
||||
noEmoji: false,
|
||||
ga: ''
|
||||
ga: '',
|
||||
mergeNavbar: false
|
||||
}, window.$docsify)
|
||||
|
||||
const script = document.currentScript ||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import { markdown, sidebar, subSidebar, cover } from './compiler'
|
|||
import { callHook } from '../init/lifecycle'
|
||||
import { getBasePath, getPath, isAbsolutePath } from '../route/util'
|
||||
import { isPrimitive } from '../util/core'
|
||||
import { isMobile } from '../util/env'
|
||||
|
||||
function executeScript () {
|
||||
const script = dom.findAll('.markdown-section>script')
|
||||
|
|
@ -153,12 +154,8 @@ export function initRender (vm) {
|
|||
|
||||
let el = dom.find(id)
|
||||
let html = ''
|
||||
let navAppendToTarget = dom.body
|
||||
|
||||
navEl.classList.add('app-nav')
|
||||
|
||||
if (!config.repo) {
|
||||
navEl.classList.add('no-badge')
|
||||
}
|
||||
if (!el) {
|
||||
el = dom.create(id)
|
||||
dom.appendTo(dom.body, el)
|
||||
|
|
@ -173,8 +170,19 @@ export function initRender (vm) {
|
|||
html += tpl.main(config)
|
||||
// Render main app
|
||||
vm._renderTo(el, html, true)
|
||||
|
||||
if (config.mergeNavbar && isMobile) {
|
||||
navAppendToTarget = dom.find('.sidebar')
|
||||
} else {
|
||||
navEl.classList.add('app-nav')
|
||||
|
||||
if (!config.repo) {
|
||||
navEl.classList.add('no-badge')
|
||||
}
|
||||
}
|
||||
|
||||
// Add nav
|
||||
dom.before(dom.body, navEl)
|
||||
dom.before(navAppendToTarget, navEl)
|
||||
|
||||
if (config.themeColor) {
|
||||
dom.$.head.innerHTML += tpl.theme(config.themeColor)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue