swanx
返回值
返回storeManger对象,storeManger对象包括以下方法
名称 | 类型 | 说明 |
---|
subscribe | Function | 订阅方法 |
getState | Function | 获取state值 |
dispatch | Function | 更改store上数据状态,并触发有依赖的监听函数 |
unsubscribeAll | Function | 清空所有订阅,无参数传入 |
storeManger对象的subscribe方法参数
名称 | 类型 | 说明 |
---|
fields | Object/Array | 会变化的数据,默认fields中所有数据变化都会触发回调函数 |
callback | Function | 数据变化时的回调函数 |
storeManger对象的getState方法参数
名称 | 类型 | 说明 |
---|
actionName | string | action方法名 |
data | Object/Array/String | 需要更新的数据 |
storeBinding方法参数说明
名称 | 类型 | 说明 |
---|
target | Object | 当前上下文 |
store | Object | 创建后的store |
返回值
connect方法参数说明
名称 | 类型 | 说明 |
---|
constructor | Object | 页面或组件原型 |
store | Object | 创建后的store,如果没填则默认使用当前组件的父页面的store |
代码示例
扫码体验
图片示例

安装
代码示例2