Skip to content

Commit 4ab63c1

Browse files
committedJul 6, 2019
fix(wx-react-redux): 修改mapDispatchToProps 传递对象报错
1 parent 63fd81b commit 4ab63c1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎packages/wx-react-redux/miniprogram_dist/connect.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
import shallowEqual from "./shallowEqual"
1010
import React, {HocComponent} from '@areslabs/wx-react'
11+
import {bindActionCreators} from '@areslabs/wx-redux'
1112
import PropTypes from '@areslabs/wx-prop-types'
1213

1314
export default function connect(mapStateToProps, mapDispatchToProps) {
@@ -39,7 +40,10 @@ export default function connect(mapStateToProps, mapDispatchToProps) {
3940

4041

4142
let o2 = null
42-
if (mapDispatchToProps) {
43+
44+
if (mapDispatchToProps && typeof mapDispatchToProps === 'object') {
45+
o2 = bindActionCreators(mapDispatchToProps, this.store.dispatch)
46+
} else if (mapDispatchToProps && typeof mapDispatchToProps === 'function') {
4347
o2 = mapDispatchToProps(this.store.dispatch, this.props)
4448
} else {
4549
o2 = {

‎packages/wx-react-redux/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@areslabs/wx-react-redux",
3-
"version": "1.0.2",
3+
"version": "1.0.3",
44
"description": "微信版本的react-redux",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)