vuex

https://vuex.vuejs.org/zh/guide/actions.html

单向数据流

单例模式 & 多个组件共享状态

State & 状态注入

Vue.use(Vuex) 将状态从根组件“注入”到每一个子组件中

mapState

Getter

store 的计算属性

mapGetters

Mutation

常量 & 事件类型

mapMutations & 同步事务

Action

https://vuex.vuejs.org/zh/guide/actions.html

mapActions

Async & Promise

Module

局部状态

context && {...obj} , {key1, key2}

namespace

root

Getter (state, getters, rootState, rootGetters) { ... }

Action (ctx, payload) { ... }

mapState, mapGetters, mapActionsmapMutations


computed: {
  ...mapState('some/nested/module', {
    a: state => state.a,
    b: state => state.b
  })
},
methods: {
  ...mapActions('some/nested/module', [
    'foo', // -> this.foo()
    'bar' // -> this.bar()
  ])
}

createNamespacedHelpers

https://vuex.vuejs.org/zh/api/#mapstate

vue & SSR

https://ssr.vuejs.org/guide/structure.html#avoid-stateful-singletons


Vuex

store data flow

  1. Components ==dispatch==> Actions ==commit==> Mutations ==mutate=> State ==render==> Components

  2. Components ==commit==> Mutations ==mutate=> State ==render==> Components

  • Actions & Async
  • Mutations & Sync

最新文章

  1. 分布式系列文章——从ACID到CAP/BASE
  2. Open-Test 测试驱动模式与版本号管理机制
  3. the import android cannot be resolved
  4. Html简单介绍
  5. correlation filters in object tracking
  6. apk反编译、smali修改、回编译笔记
  7. Bugtags 介绍视频 - App 测试 · 从未如此简单
  8. 杭电hdoj题目分类
  9. Segment Tree Modify
  10. winform C#屏幕右下角弹出消息框并自动消失
  11. Linux常用C函数---内存控制篇
  12. 解析ASP.NET Mvc开发之删除修改数据
  13. 【Android Training - UserInfo】记住登入用户的信息[Lesson 1 - 使用AccountManager来记住用户]
  14. java复习-多线程
  15. node源码详解(二 )—— 运行机制 、整体流程
  16. (三):C++分布式实时应用框架——系统管理模块
  17. Git:fatal: refusing to merge unrelated histories
  18. 11 Django REST Framework 针对基于类的视图添加 @csrf_exempt
  19. HDU3507-Print Article-斜率dp入门题
  20. python狂犬病大数据分析

热门文章

  1. caffe怎么把全连接层转成convolutional层
  2. 【杂题总汇】HDU2018多校赛第九场 Rikka with Nash Equilibrium
  3. django+xadmin在线教育平台(十)
  4. PHP CodeIgniter框架实现读写分离
  5. 【UE4】二十四、UE4内部版本引擎和官方版本引擎版本保持兼容的方法
  6. saltstack执行远程命令
  7. java程序——凯撒加密
  8. css3 3D
  9. win32 signal
  10. hash算法和常见的hash函数 [转]