起步软件技术论坛
搜索
 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 2475|回复: 7

[处理中3] 模式1,跨页即时传值怎么弄?

[复制链接]

17

主题

34

帖子

102

积分

初级会员

Rank: 2

积分
102
QQ
发表于 2016-7-29 13:31:15 | 显示全部楼层 |阅读模式
按照淘宝的例子,如何跨页传给main的Container子页传值?
比如订单页花完钱,钱如何传到main的最后一个模板里用户上显示?
由于是模式1打包,如果靠读取数据库的话可能要刷新好几下,才能把数据读出来而不能实时,怎么操作能实时显示呢?

23

主题

89

帖子

303

积分

中级会员

Rank: 3Rank: 3

积分
303
QQ
发表于 2016-7-29 15:09:52 | 显示全部楼层
其实淘宝的案例就有给你,
        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);
                }

        };
回复 支持 反对

使用道具 举报

23

主题

89

帖子

303

积分

中级会员

Rank: 3Rank: 3

积分
303
QQ
发表于 2016-7-29 15:10:49 | 显示全部楼层
获取container link页面的model对象,然后再控制该页面的事件
回复 支持 反对

使用道具 举报

17

主题

34

帖子

102

积分

初级会员

Rank: 2

积分
102
QQ
 楼主| 发表于 2016-7-29 17:10:34 | 显示全部楼层
第二步实现了
那第一步呢,比如和main页面没有太大关系的detail,怎么立刻修改main上的数值呢?
回复 支持 反对

使用道具 举报

23

主题

89

帖子

303

积分

中级会员

Rank: 3Rank: 3

积分
303
QQ
发表于 2016-7-30 08:18:04 | 显示全部楼层
你对案例不认真研究的。。。main页面会注册一些事件,然后在子页面调用

main
        // 添加事件
        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);
        };


这是子页面的

        justep.Shell.fireEvent("onShoppingContent",{});
                justep.Shell.showMainPage();

回复 支持 反对

使用道具 举报

发表于 2016-7-30 14:34:01 | 显示全部楼层
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

53

主题

148

帖子

580

积分

高级会员

Rank: 4

积分
580
QQ
发表于 2018-7-19 16:33:50 | 显示全部楼层
请问这个问题是怎么解决的?
我从子页面跳到首页的购物车,需要点击两次才能跳转成功,求大神解答疑惑,以下代码是我用的跳转方法:
justep.Shell.fireEvent("onShoppingContent",{});
justep.Shell.showMainPage();
回复 支持 反对

使用道具 举报

发表于 2018-7-19 16:40:25 | 显示全部楼层
cutesun 发表于 2018-7-19 16:33
请问这个问题是怎么解决的?
我从子页面跳到首页的购物车,需要点击两次才能跳转成功,求大神解答疑惑,以 ...

这样,你试试平台案例,比如仿途牛,在详细页面直接调用
justep.Shell.showMainPage();
可以回到首页吗?本地测试没问题呢!
qq:1912779713
WeX5教程--WeX5下载
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|X3技术论坛|Justep Inc.    

GMT+8, 2024-9-25 01:19 , Processed in 0.055911 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表