{"action":"opened","issue":{"url":"https://api.github.com/repos/Tencent/wepy/issues/975","repository_url":"https://api.github.com/repos/Tencent/wepy","labels_url":"https://api.github.com/repos/Tencent/wepy/issues/975/labels{/name}","comments_url":"https://api.github.com/repos/Tencent/wepy/issues/975/comments","events_url":"https://api.github.com/repos/Tencent/wepy/issues/975/events","html_url":"https://github.com/Tencent/wepy/issues/975","id":299930139,"number":975,"title":"通过wx:if=\"{{false}}\"不渲染的组件也会触发其onLoad生命周期函数","user":{"login":"lichangwei","id":718802,"avatar_url":"https://avatars3.githubusercontent.com/u/718802?v=4","gravatar_id":"","url":"https://api.github.com/users/lichangwei","html_url":"https://github.com/lichangwei","followers_url":"https://api.github.com/users/lichangwei/followers","following_url":"https://api.github.com/users/lichangwei/following{/other_user}","gists_url":"https://api.github.com/users/lichangwei/gists{/gist_id}","starred_url":"https://api.github.com/users/lichangwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lichangwei/subscriptions","organizations_url":"https://api.github.com/users/lichangwei/orgs","repos_url":"https://api.github.com/users/lichangwei/repos","events_url":"https://api.github.com/users/lichangwei/events{/privacy}","received_events_url":"https://api.github.com/users/lichangwei/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-02-24T10:11:56Z","updated_at":"2018-02-24T10:11:56Z","closed_at":null,"author_association":"NONE","body":"通过查看编译后的代码发现：wepy的组件化只是在代码编写时期，并非在代码执行时期。编译会把各个子组件合并到页面文件中去。\r\n测试代码如下\r\n```html\r\n//mypage.wpy\r\n<style lang=\"less\">\r\n</style>\r\n<template>\r\n    <mycomp wx:if=\"{{false}}\" />\r\n</template>\r\n<script>\r\n    import wepy from 'wepy';\r\n    import MyComp from '../components/mycomp';\r\n\r\n    export default class MyPage extends wepy.page{\r\n        components = {\r\n            'mycomp': MyComp,\r\n        }\r\n    }\r\n</script>\r\n```\r\n```html\r\n//mycomp.wpy\r\n<style lang=\"less\">\r\n</style>\r\n<template>\r\n    <view>mycomp</view>\r\n</template>\r\n<script>\r\n    import wepy from 'wepy';\r\n\r\n    export default class MyComp extends wepy.component{\r\n        onLoad(){\r\n            console.log('onload');\r\n        }\r\n    }\r\n</script>\r\n```\r\n运行之后发现mycomp组件确实因为wx:if=\"{{false}}\"没有显示出来，但是mycomp组件的onload生命周期函数去触发了。"}}
{"actor":{"display_login":"lichangwei"}}