2019-11-06 | 8036

问答store 是如何实现注入vue

答案:

Vue.use(Vuex) 方法执行的是 install 方法,它实现了 Vue 实例对象的 init 方法封装和注入,使传入的 store 对象被设置到 Vue 上下文环境的$store 中。因此在 Vue Component 任意地方都能够通过 this.$store 访问到该 store。

发表评论

    评价:
    Rich Text Editor
    最新评论