# Functions
- registerState(type, [value])
注册 state
- registerGetter(type, [getter])
注册 getter
- registerMutation(type, [mutation], [increment])
注册 mutation
- registerAction(type, url, [action], [params])
注册 Action 方法
- register(option)
注册单个 store 模块
目的旨在简化 store 注册结构,减少重复劳动。
默认情况下 state, getter, mutation 都会进行注册(设置成 false 可强制不注册)
设置自定义 action 或者 url 配置会注册 action 方法(将 action 设置成 false,或者 action 和 url 都不设置可强制不注册)
在指定 increment 增量保存数据开关为打开状态时,必须保障对应的 state 为 Object 类型
- output() ⇒
EasyStoreModule
输出 Store.Module 配置数据
# registerState(type, [value])
注册 state
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
type | string | 类型标识 | |
[value] | any |
| 初始化数据 |
# registerGetter(type, [getter])
注册 getter
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
type | string | 类型标识 | |
[getter] | Getter |
| 初始化数据 |
# registerMutation(type, [mutation], [increment])
注册 mutation
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
type | string | 类型标识 | |
[mutation] | Mutation |
| 初始化数据 |
[increment] | Boolean | false | 是否使用增量保存方法将数据保存到 state |
# registerAction(type, url, [action], [params])
注册 Action 方法
Kind: global function
Param | Type | Default | Description |
---|---|---|---|
type | String | 类型标识 | |
url | URLConfig | 接口配置地址(若不配置将省略 action 的注册) | |
[action] | Action |
| |
[params] | CommonParams |
| 每次请求都会加入的全局参数数据,如 {data:{a:10,...}, conf:{headers:{...}, timeout:1000}} |
# register(option)
注册单个 store 模块
目的旨在简化 store 注册结构,减少重复劳动。
默认情况下 state, getter, mutation 都会进行注册(设置成 false 可强制不注册)
设置自定义 action 或者 url 配置会注册 action 方法(将 action 设置成 false,或者 action 和 url 都不设置可强制不注册)
在指定 increment 增量保存数据开关为打开状态时,必须保障对应的 state 为 Object 类型
Kind: global function
Param | Type | Description |
---|---|---|
option | EasyStoreConfig | 配置 |
# output() ⇒ EasyStoreModule
输出 Store.Module 配置数据
Kind: global function