Skip to content

Commit

Permalink
0.6.2 组件onLoad options 丢失bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Liang Xingchen committed Nov 24, 2016
1 parent 3d18579 commit f801387
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion component.js
Expand Up @@ -170,7 +170,7 @@ export default class Component {
if (__DEV__) {
console.log('%c%s onLoad()', 'color:#9a23cc', this.id);
}
this.onLoad();
this.onLoad(this.page._loadOptions);
}

if (key && this.page._ready) {
Expand Down
5 changes: 3 additions & 2 deletions create-page.js
Expand Up @@ -83,11 +83,12 @@ module.exports = function createPage(ComponentClass: Class<Component>) {
};
});

config.onLoad = function () {
config.onLoad = function (options: Object) {
page = this;
page.page = page;
page._show = false;
page._ready = false;
page._loadOptions = options;

page.updateData = function (newData: Object) {
// if (__DEV__) {
Expand Down Expand Up @@ -122,7 +123,7 @@ module.exports = function createPage(ComponentClass: Class<Component>) {
console.error(error.stack);
}
if (root.onLoad) {
root.onLoad();
root.onLoad(options);
}
};

Expand Down
1 change: 1 addition & 0 deletions flow/labrador.js
Expand Up @@ -61,6 +61,7 @@ declare interface $Page {
__route__: string;
_ready: boolean;
_show: boolean;
_loadOptions: Object;
root: Component;
page: $Page;
data: $DataMap;
Expand Down
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "labrador",
"version": "0.6.1",
"version": "0.6.2",
"description": "微信小程序模块化开发框架",
"keywords": [
"wxa",
Expand Down

0 comments on commit f801387

Please sign in to comment.