Allow injecting Vue, app, router#80
Conversation
There was a problem hiding this comment.
I think this is useful, but one change needed: instead of injecting app, we should call the inject function before app is created and pass it the raw options. This way the user can inject additional options into the root instance, for example a Vuex store:
import Vuex from 'vuex'
const store = new Vuex.Store({ ... })
export default ({ Vue, options }) => {
Vue.use(Vuex)
options.store = store
}|
Also, I'd change the name from |
|
@yyx990803 哈哈,老大,我想睡觉了。英语不咋好,就不费劲了。 首先,你的建议很棒,我应该是全盘接受了。 其次,通过 enhanceApp.js 其实就可以搞插件了,在其中注册某些组件,比如 demo-box 之类的,就可以在文档里直接用了。 最后,请收下 PR。🤗 |
| }) | ||
| const options = {} | ||
|
|
||
| enhanceApp({ Vue, options }) |
There was a problem hiding this comment.
We still need router here so users can register extra router hooks 😂
|
How to inject (define) --- updated Sovled by using configureWebpack https://vuepress.vuejs.org/config/#configurewebpack |
.vuepress/inject.js:
readme.md: