{"action":"opened","issue":{"url":"https://api.github.com/repos/xiamu14/learn/issues/12","repository_url":"https://api.github.com/repos/xiamu14/learn","labels_url":"https://api.github.com/repos/xiamu14/learn/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/xiamu14/learn/issues/12/comments","events_url":"https://api.github.com/repos/xiamu14/learn/issues/12/events","html_url":"https://github.com/xiamu14/learn/issues/12","id":376241088,"node_id":"MDU6SXNzdWUzNzYyNDEwODg=","number":12,"title":"【待确认 issue】taro 编译 if... else 内的 列表组件后，小程序报错","user":{"login":"xiamu14","id":10813360,"node_id":"MDQ6VXNlcjEwODEzMzYw","avatar_url":"https://avatars3.githubusercontent.com/u/10813360?v=4","gravatar_id":"","url":"https://api.github.com/users/xiamu14","html_url":"https://github.com/xiamu14","followers_url":"https://api.github.com/users/xiamu14/followers","following_url":"https://api.github.com/users/xiamu14/following{/other_user}","gists_url":"https://api.github.com/users/xiamu14/gists{/gist_id}","starred_url":"https://api.github.com/users/xiamu14/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiamu14/subscriptions","organizations_url":"https://api.github.com/users/xiamu14/orgs","repos_url":"https://api.github.com/users/xiamu14/repos","events_url":"https://api.github.com/users/xiamu14/events{/privacy}","received_events_url":"https://api.github.com/users/xiamu14/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-01T03:35:28Z","updated_at":"2018-11-01T03:35:28Z","closed_at":null,"author_association":"OWNER","body":"类似如下代码：\r\n```javascript\r\nif(current === 0) {\r\nlist.map((item, index) => return ())\r\n} else {\r\nlist.map((item, index) => return ())\r\n}\r\n```\r\n编译后会出现 \r\n```html\r\n<view wx:key=\"{{index}}\" wx:for=\"{{getRecordList}}\" wx:for-item=\"item\"\r\n     |                     ^\r\n  40 |                     wx:for-index=\"index\" wx:else>\r\n```\r\n貌似 wx-if \\ wx-else 和 wx-for 不能用在同一个标签上面。\r\n上面的出错的代码可以修改为 两个 if 的判断\r\n```javascript\r\nif(current === 0) {\r\nlist.map((item, index) => return ())\r\n} \r\nif(current === 1 ) {\r\nlist.map((item, index) => return ())\r\n}\r\n```\r\n或者 \r\n```javascript\r\nelse if(current === 1) \r\n```\r\n这两种形式不会报错！"}}
{"actor":{"display_login":"xiamu14"}}