|
本帖最后由 dew3083412 于 2016-5-18 11:08 编辑
仿淘宝案例,用户在detail添加商品后,跳转到cart页面,在触发cart页面数据重载事件时,event对象不知道如何传过去(因为呼叫baas要event一些参数)
因为cart页面是放在windowcontainer中,进入main就会加载,所以不能用modelParamsReceive传递
目前我是这样做
1.在main页面增加一个跨页面调用方法 shoppingModel.refreshCartData(event);
- Model.prototype.onShoppingContent = function(event) {
- this.lastContentXid = this.comp("contents2").getActiveXid();
- this.comp("contents2").to("shoppingContent");
- var shoppingModel = this.comp("shoppingContainer").getInnerModel();
- if (shoppingModel) {
- shoppingModel.showBackBtn(true);
- shoppingModel.refreshCartData(event);
- }
- };
复制代码
2.在cart 页面
- <p><p> Model.prototype.refreshCartData = function(event){
- /*
- 1、刷新购物车数据
- */
- var dataGoods =this.comp("goodsData");
- dataGoods.clear();
- Baas.sendRequest({
- "url" : "/kkkk/SYS_Cart",
- "action" : "getCartList",
- "async" : false,
- "params" : {
- "limit" : event.source.limit,
- "columns" :Baas.getDataColumns(dataGoods),
- "offset" : event.source.offset,
- "shop_id" : this.shopID,
- "user_id" : this.userID
- },
- "success" : function(resultData) {
- var append = event.options && event.options.append;
- dataGoods.loadData(resultData, append);
- dataGoods.refreshData(true);
- },
- "error":function(data){
- justep.Util.hint(data);
- }
- });
- };</p><p> </p><p> </p><p>执行会报错,说不能识别limit属性,看起来是event的传参有问题</p>
复制代码 |
|