首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

【手写Vuex】-手撕Vuex-模块化共享数据

模块化中 getters/mutations/actions 的使用我们知道在 Store 当中,我们可以使用 getters/mutations/actions 这三个方法,那么这三个方法在模块化当中是怎么使用的呢...好了这里我们已经知道了全局的 getters/mutations/actions 的使用,那么模块化当中的 getters/mutations/actions 的使用又是怎么样的呢,我们来看看。...我先不管三七二十一,我在 home 模块中的 getters/mutations/actions 中定义方法,如下:首页模块:getters: { getHomeName(state) {...那么我们从 getters/mutations/actions 中获取数据呢,如果获取的是模块中getters共享的数据, 那么不需要加上模块的名称,代码如下:{{ this....首页模块的我们编写完毕了,接着来编写个人中心模块的 getters/mutations/actions 的使用,其实和首页模块的 getters/mutations/actions 的使用是一样的,我们来看看

15511
领券