|

楼主 |
发表于 2017-3-1 09:13:53
|
显示全部楼层
像淘宝这样写吗?
// 添加事件
Model.prototype.modelLoad = function(event) {
justep.Shell.on("onRestoreContent", this.onRestoreContent, this);
justep.Shell.on("onShoppingContent", this.onShoppingContent, this);
justep.Shell.on("onHomeContent", this.onHomeContent, this);
};
// 卸载事件
Model.prototype.modelUnLoad = function(event) {
justep.Shell.off("onRestoreContent", this.onRestoreContent);
justep.Shell.off("onShoppingContent", this.onShoppingContent);
justep.Shell.off("onHomeContent", this.onHomeContent);
};
// 返回上一次的content
Model.prototype.onRestoreContent = function(event) {
this.comp("contents2").to(this.lastContentXid);
};
// 记住当前content,切换到购物车页
Model.prototype.onShoppingContent = function(event) {
this.lastContentXid = this.comp("contents2").getActiveXid();
this.comp("contents2").to("shoppingContent");
var shoppingModel = this.comp("navContainer4").getInnerModel();
if (shoppingModel) {
shoppingModel.showBackBtn(true);
}
};
// 切换到首页
Model.prototype.onHomeContent = function(event) {
this.comp("contents2").to("homeContent");
};
|
|