提交 37ea038c 编写于 作者: 方剑成 提交者: Evan You

feat: enhanceApp.js (#80)

上级 18849536
......@@ -6,6 +6,7 @@ import dataMixin from './dataMixin'
import NotFound from '@notFound'
import { routes } from '@temp/routes'
import { siteData } from '@temp/siteData'
import enhanceApp from '@temp/enhanceApp'
// suggest dev server restart on base change
if (module.hot) {
......@@ -64,7 +65,12 @@ export function createApp () {
}
})
const app = new Vue({
const options = {}
enhanceApp({ Vue, options, router })
const app = new Vue(
Object.assign(options, {
router,
render (h) {
return h('div', { attrs: { id: 'app' }}, [
......@@ -72,6 +78,7 @@ export function createApp () {
])
}
})
)
return { app, router }
}
......@@ -50,6 +50,16 @@ if (!Object.assign) Object.assign = require('object-assign')`
await writeTemp(`override.styl`, hasUserOverride ? `@import(${JSON.stringify(overridePath)})` : ``)
}
// 6. handle enhanceApp.js
const enhancePath = path.resolve(sourceDir, '.vuepress/enhanceApp.js')
const hasEnhancePath = fs.existsSync(enhancePath)
await writeTemp(
'enhanceApp.js',
hasEnhancePath
? `export { default } from ${JSON.stringify(enhancePath)}`
: `export default function () {}`
)
return options
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册