tolerance-go / weappx

🌱基于 redux 的轻量级小程序状态管理框架,适配原生小程序,wepy,taro
MIT License
144 stars 19 forks source link

wepy自带的connect太难用 #16

Open kaiyuanlee opened 5 years ago

kaiyuanlee commented 5 years ago

import { connect } from 'wepy-redux' @connect({ ordersn: state => state.orderdetail.ordersn, isLoading: state => state.orderdetail.isLoading, loginStatus: state => state.global.loginStatus, userInfo: state => state.global.userInfo, })

而在dva里所有的这样写就完事了

import { connect } from 'react-redux' @connect(({ orderdetail, global }) => ({ ...orderdetail, ...global }))

orderdetail和global是namespace

亲,有什么好的解决办法吗? 如果这个页面使用的state比较多,每一个都要定义一行,很繁琐,dva直接就把这个namespace展开了

tolerance-go commented 5 years ago

emm 我没有想到好的方法,wepy 里可能图省事,因为它直接作为 computed 属性嘛,所以写法就和它一样了

ps:weappx-weapp 的写法也是这样的。。。