Add context to ViewModel

This commit is contained in:
pengfei.zhou
2020-09-21 15:58:45 +08:00
committed by osborn
parent 0f9bed3734
commit e0358a3f81
7 changed files with 11 additions and 2 deletions

View File

@@ -3476,6 +3476,7 @@ var VMPanel = /** @class */ (function (_super) {
VMPanel.prototype.build = function (root) {
this.vh = new (this.getViewHolderClass());
this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
this.vm.context = this.context;
this.vm.attach(root);
};
return VMPanel;

View File

@@ -2695,6 +2695,7 @@ class VMPanel extends Panel {
build(root) {
this.vh = new (this.getViewHolderClass());
this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
this.vm.context = this.context;
this.vm.attach(root);
}
}

View File

@@ -4184,6 +4184,7 @@ class VMPanel extends Panel {
build(root) {
this.vh = new (this.getViewHolderClass());
this.vm = new (this.getViewModelClass())(this.getState(), this.vh);
this.vm.context = this.context;
this.vm.attach(root);
}
}