mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 22:25:12 +00:00
user specified base then add base in html head
This commit is contained in:
parent
0d9627b488
commit
50a8648eeb
@ -42,6 +42,7 @@ class Nuxt {
|
||||
router: {
|
||||
mode: 'history',
|
||||
base: '/',
|
||||
userSpecifiedBase: false,
|
||||
middleware: [],
|
||||
linkActiveClass: 'nuxt-link-active',
|
||||
linkExactActiveClass: 'nuxt-link-exact-active',
|
||||
@ -62,6 +63,7 @@ class Nuxt {
|
||||
// Sanitization
|
||||
if (options.loading === true) delete options.loading
|
||||
if (options.router && typeof options.router.middleware === 'string') options.router.middleware = [ options.router.middleware ]
|
||||
if (options.router && typeof options.router.base === 'string') options.router.userSpecifiedBase = true
|
||||
if (typeof options.transition === 'string') options.transition = { name: options.transition }
|
||||
this.options = _.defaultsDeep(options, defaults)
|
||||
// Env variables
|
||||
|
@ -94,7 +94,9 @@ export async function renderRoute (url, context = {}) {
|
||||
}
|
||||
const m = context.meta.inject()
|
||||
let HEAD = m.meta.text() + m.title.text() + m.link.text() + m.style.text() + m.script.text() + m.noscript.text()
|
||||
HEAD += `<base href="${self.options.router.base}">`
|
||||
if (self.options.router.userSpecifiedBase) {
|
||||
HEAD += `<base href="${self.options.router.base}">`
|
||||
}
|
||||
HEAD += context.renderResourceHints() + context.renderStyles()
|
||||
APP += `<script type="text/javascript">window.__NUXT__=${serialize(context.nuxt, { isJSON: true })}</script>`
|
||||
APP += context.renderScripts()
|
||||
|
Loading…
Reference in New Issue
Block a user