Vuex, api, SSR, module
2024-10-01 05:27:01
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, mapActions
和mapMutations
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
Components ==dispatch==> Actions ==commit==> Mutations ==mutate=> State ==render==> Components
Components ==commit==> Mutations ==mutate=> State ==render==> Components
- Actions & Async
- Mutations & Sync
最新文章
- 分布式系列文章——从ACID到CAP/BASE
- Open-Test 测试驱动模式与版本号管理机制
- the import android cannot be resolved
- Html简单介绍
- correlation filters in object tracking
- apk反编译、smali修改、回编译笔记
- Bugtags 介绍视频 - App 测试 · 从未如此简单
- 杭电hdoj题目分类
- Segment Tree Modify
- winform C#屏幕右下角弹出消息框并自动消失
- Linux常用C函数---内存控制篇
- 解析ASP.NET Mvc开发之删除修改数据
- 【Android Training - UserInfo】记住登入用户的信息[Lesson 1 - 使用AccountManager来记住用户]
- java复习-多线程
- node源码详解(二 )—— 运行机制 、整体流程
- (三):C++分布式实时应用框架——系统管理模块
- Git:fatal: refusing to merge unrelated histories
- 11 Django REST Framework 针对基于类的视图添加 @csrf_exempt
- HDU3507-Print Article-斜率dp入门题
- python狂犬病大数据分析