Skip to content

Commit

Permalink
fix(wx-react-redux): 修改mapDispatchToProps 传递对象报错
Browse files Browse the repository at this point in the history
  • Loading branch information
ykforerlang committed Jul 6, 2019
1 parent 63fd81b commit 4ab63c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion packages/wx-react-redux/miniprogram_dist/connect.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import shallowEqual from "./shallowEqual"
import React, {HocComponent} from '@areslabs/wx-react'
import {bindActionCreators} from '@areslabs/wx-redux'
import PropTypes from '@areslabs/wx-prop-types'

export default function connect(mapStateToProps, mapDispatchToProps) {
Expand Down Expand Up @@ -39,7 +40,10 @@ export default function connect(mapStateToProps, mapDispatchToProps) {


let o2 = null
if (mapDispatchToProps) {

if (mapDispatchToProps && typeof mapDispatchToProps === 'object') {
o2 = bindActionCreators(mapDispatchToProps, this.store.dispatch)
} else if (mapDispatchToProps && typeof mapDispatchToProps === 'function') {
o2 = mapDispatchToProps(this.store.dispatch, this.props)
} else {
o2 = {
Expand Down
2 changes: 1 addition & 1 deletion packages/wx-react-redux/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@areslabs/wx-react-redux",
"version": "1.0.2",
"version": "1.0.3",
"description": "微信版本的react-redux",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4ab63c1

Please sign in to comment.