{"action":"created","issue":{"url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/567","repository_url":"https://api.github.com/repos/Meituan-Dianping/mpvue","labels_url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/567/labels{/name}","comments_url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/567/comments","events_url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/567/events","html_url":"https://github.com/Meituan-Dianping/mpvue/issues/567","id":327624616,"node_id":"MDU6SXNzdWUzMjc2MjQ2MTY=","number":567,"title":"组件传值 值获取有延迟 生命周期中何时可获取准确数据","user":{"login":"xiaojiangjiang","id":8230871,"node_id":"MDQ6VXNlcjgyMzA4NzE=","avatar_url":"https://avatars1.githubusercontent.com/u/8230871?v=4","gravatar_id":"","url":"https://api.github.com/users/xiaojiangjiang","html_url":"https://github.com/xiaojiangjiang","followers_url":"https://api.github.com/users/xiaojiangjiang/followers","following_url":"https://api.github.com/users/xiaojiangjiang/following{/other_user}","gists_url":"https://api.github.com/users/xiaojiangjiang/gists{/gist_id}","starred_url":"https://api.github.com/users/xiaojiangjiang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xiaojiangjiang/subscriptions","organizations_url":"https://api.github.com/users/xiaojiangjiang/orgs","repos_url":"https://api.github.com/users/xiaojiangjiang/repos","events_url":"https://api.github.com/users/xiaojiangjiang/events{/privacy}","received_events_url":"https://api.github.com/users/xiaojiangjiang/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-05-30T08:25:24Z","updated_at":"2018-06-05T13:57:49Z","closed_at":null,"author_association":"NONE","body":"# [问题简单描述]\r\n当前页面数据异步获取后，通过props传递给组件，组件生命周期中打印的值不准确\r\n\r\n**问题复现步骤:**\r\n\r\n1. [在页面中异步获取haveList数据]\r\n``` javascript\r\n<template>\r\n    <rollscreen :lists=\"haveList\">\r\n</template>\r\n<script>\r\nexport default {\r\n    mounted() {\r\n        //异步请求开始\r\n        ...\r\n        this.haveList = res['lists'];\r\n    }，\r\n\r\n}\r\n</script>\r\n```\r\n\r\n2. [在rollscreen组件中]\r\n``` javascript\r\n<template>\r\n    <div class=\"scrollItem\" v-for=\"(item, index) in lists\" :key=\"index\">{{ item }}</div>\r\n</template>\r\n<script>\r\nexport default {\r\n    props: {\r\n        lists: {\r\n            type: Array,\r\n            require: true,\r\n            default: () => {[]}\r\n        }\r\n    },\r\n    mounted() {\r\n        console.log(this.lists);\r\n    }，\r\n    onLoad() {\r\n        console.log(this.lists);\r\n    }\r\n}\r\n</script>\r\n```\r\n\r\n**期望的表现:**\r\nmounted中打印的数据与传递的数据一致\r\n如何能精确获得异步后的传入组件值\r\n\r\n**观察到的表现:**\r\nmounted中打印的数据为空数组, onLoad中打印的数据也为空\r\n\r\n\r\n**屏幕截图和动态 GIF 图**\r\n- 微信工具中AppData中的数据\r\n![image](https://user-images.githubusercontent.com/8230871/40709481-bae8b102-6428-11e8-9270-4b8f3f20046c.png)\r\n- 控制台中打印的数据\r\n![image](https://user-images.githubusercontent.com/8230871/40709491-c51c3194-6428-11e8-9b09-cc3463e049ba.png)\r\n"},"comment":{"url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/comments/394719065","html_url":"https://github.com/Meituan-Dianping/mpvue/issues/567#issuecomment-394719065","issue_url":"https://api.github.com/repos/Meituan-Dianping/mpvue/issues/567","id":394719065,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDcxOTA2NQ==","user":{"login":"F-loat","id":16759376,"node_id":"MDQ6VXNlcjE2NzU5Mzc2","avatar_url":"https://avatars0.githubusercontent.com/u/16759376?v=4","gravatar_id":"","url":"https://api.github.com/users/F-loat","html_url":"https://github.com/F-loat","followers_url":"https://api.github.com/users/F-loat/followers","following_url":"https://api.github.com/users/F-loat/following{/other_user}","gists_url":"https://api.github.com/users/F-loat/gists{/gist_id}","starred_url":"https://api.github.com/users/F-loat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/F-loat/subscriptions","organizations_url":"https://api.github.com/users/F-loat/orgs","repos_url":"https://api.github.com/users/F-loat/repos","events_url":"https://api.github.com/users/F-loat/events{/privacy}","received_events_url":"https://api.github.com/users/F-loat/received_events","type":"User","site_admin":false},"created_at":"2018-06-05T13:57:49Z","updated_at":"2018-06-05T13:57:49Z","author_association":"CONTRIBUTOR","body":"`default: () => []` 实际列表有渲染出来没"}}
{"actor":{"display_login":"F-loat"}}