{"action":"opened","issue":{"url":"https://api.github.com/repos/NervJS/taro/issues/363","repository_url":"https://api.github.com/repos/NervJS/taro","labels_url":"https://api.github.com/repos/NervJS/taro/issues/363/labels{/name}","comments_url":"https://api.github.com/repos/NervJS/taro/issues/363/comments","events_url":"https://api.github.com/repos/NervJS/taro/issues/363/events","html_url":"https://github.com/NervJS/taro/issues/363","id":343317262,"node_id":"MDU6SXNzdWUzNDMzMTcyNjI=","number":363,"title":"render里面jsx不能整合数据，必须在外卖呢整合好了才能使用，否则会报错","user":{"login":"wangjingwj","id":13778018,"node_id":"MDQ6VXNlcjEzNzc4MDE4","avatar_url":"https://avatars3.githubusercontent.com/u/13778018?v=4","gravatar_id":"","url":"https://api.github.com/users/wangjingwj","html_url":"https://github.com/wangjingwj","followers_url":"https://api.github.com/users/wangjingwj/followers","following_url":"https://api.github.com/users/wangjingwj/following{/other_user}","gists_url":"https://api.github.com/users/wangjingwj/gists{/gist_id}","starred_url":"https://api.github.com/users/wangjingwj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wangjingwj/subscriptions","organizations_url":"https://api.github.com/users/wangjingwj/orgs","repos_url":"https://api.github.com/users/wangjingwj/repos","events_url":"https://api.github.com/users/wangjingwj/events{/privacy}","received_events_url":"https://api.github.com/users/wangjingwj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-21T10:37:49Z","updated_at":"2018-07-21T10:37:49Z","closed_at":null,"author_association":"NONE","body":"**问题描述**\r\n\r\n在render里面遍历数组的时候，数组返回的数据需要整合，如果在里面直接整合就会报错，必须在return之前整理好才不会报错\r\n\r\n**复现步骤**\r\n\r\n//报错的代码，主要是`${host}${item.logo_url}`这个引起的报错\r\nneedPayList && needPayList.length && needPayList.map((item,i) => {\r\n                            return (\r\n                                <View className=\"pay\">\r\n                                    <View className=\"pay-style\">\r\n                                        <View className=\"pay-style-icon\">\r\n                                            <Image src={`${host}${item.logo_url}`}   />\r\n                                        </View>\r\n                                        <View className=\"choose-btn\"></View>\r\n                                    </View>\r\n                                    <View className=\"pay-name\">账号余额<Text className=\"account-balance\"></Text></View>\r\n                                </View>\r\n                            )\r\n                        })\r\n\r\n\r\n编译报错的源码截图如下\r\n![image](https://user-images.githubusercontent.com/13778018/43034758-02fba322-8d15-11e8-9c4c-6643a6999763.png)\r\n\r\n**期望行为**\r\n\r\n上面的item.log_url选要加上域名信息，host是一个全局变量,字符串拼接，希望展示完成的图片链接\r\n**报错信息**\r\nCannot read property 'map' of undefined;at pages/confirm/index page lifeCycleMethod onLoad function\r\nTypeError: Cannot read property 'map' of undefined\r\n[这里请贴上你的**完整**报错截图或文字]\r\n![image](https://user-images.githubusercontent.com/13778018/43034650-f5192362-8d12-11e8-83d0-097bda91e819.png)\r\n\r\n**系统信息**\r\n\r\n - 操作系统: ----- Windows 10\r\n - Taro 版本 ---0.0.71\r\n - Node.js 版本 ---8.11.3\r\n\r\n**补充信息**\r\n\r\n如果我在return之前整合好数据就不会报错了，如下图\r\n![image](https://user-images.githubusercontent.com/13778018/43034677-86e57890-8d13-11e8-903a-5ca8fc16afdb.png)\r\n![image](https://user-images.githubusercontent.com/13778018/43034681-b26c7bee-8d13-11e8-84ff-f90423d9a344.png)\r\n\r\nneedPayList && needPayList.length && needPayList.map((item,i) => {\r\n            item.payStyleImg = `${host}${item.logo_url}`\r\n        });  \r\n主要是在item.payStyleImg走这一步的就没问题了，然后后续的代码里面直接使用展示就可以了，如果实在数据每一项里面直接整合数据，map就会报undefined的错误\r\n\r\n\r\n\r\n"}}
{"actor":{"display_login":"wangjingwj"}}