taro
taro copied to clipboard
在 render中, 数组的 map 如果返回的 jsx 当中有两个组件,则绑定事件有误
问题描述 在 render中, 数组的 map 如果返回的 jsx 当中有两个组件,则绑定事件有误
复现步骤
{shoppingCart.specs.map(item => (
<View className="store-confirm-product___product-wrap" key={item.id}>
<View className='store-confirm-product___product'>
<ProductIntro
image={item.image}
title={item.title}
spec={'规格:' + item.name}
price={item.price}
/>
</View>
<View className="store-confirm-infos">
<View className="store-confirm-infos___title">购买数量</View>
<View className="store-confirm-counter">
<Counter
min={0}
count={item.count}
onAdd={this.onAddCount}
onReduce={this.onReduceCount}
/>
</View>
</View>
</View>
))}
期望行为 bug 修复
报错信息
eventHandlerName 为 Counter__onAdd
如图所示,往 ProductIntro 组件当中寻找 onAdd 方法,从而报错
// 报错信息
thirdScriptError
Cannot read property 'call' of undefined;at pages/store/confirmOrder/index page Counter__onAdd function
TypeError: Cannot read property 'call' of undefined
at e.obj.(anonymous function) (http://127.0.0.1:64978/appservice/npm/@tarojs/taro-weapp/dist/index.js:2699:37)
at e.<anonymous> (http://127.0.0.1:64978/appservice/__dev__/WAService.js:1:28557)
at e.i (http://127.0.0.1:64978/appservice/__dev__/WAService.js:1:18778)
at oe (http://127.0.0.1:64978/appservice/__dev__/WAService.js:1:13049)
at Function.<anonymous> (http://127.0.0.1:64978/appservice/__dev__/WAService.js:1:14722)
at http://127.0.0.1:64978/appservice/__dev__/WAService.js:1:20277
at http://127.0.0.1:64978/appservice/__dev__/WAService.js:9:25106
at e.(anonymous function) (http://127.0.0.1:64978/appservice/__dev__/WAService.js:6:11169)
at a (http://127.0.0.1:64978/appservice/appservice?t=1531367989156:2326:9472)
at e.registerCallback (http://127.0.0.1:64978/appservice/appservice?t=1531367989156:2326:9659)
系统信息
- 操作系统: win7
- Taro 版本 v0.0.69
- Node.js 版本 v8.11.2
使用1.0.0.beta 没出现问题