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

QQ登录

只需一步,快速开始

查看: 1239|回复: 2

[结贴] 4/17日版本pages.loadContent is not a function

[复制链接]

16

主题

38

帖子

165

积分

初级会员

Rank: 2

积分
165
QQ
发表于 2015-4-17 16:16:19 | 显示全部楼层 |阅读模式
刚下载的版本,一打开就提示pages.loadContent is not a function,是因为?

0

主题

742

帖子

947

积分

高级会员

Rank: 4

积分
947
发表于 2015-4-17 16:55:57 | 显示全部楼层

新版本已经改过,可下载最新版本,
如果是已建好的文件,在向导生成门户页js中
引入文件 var WindowContainer = require("$UI/system/components/justep/windowContainer/windowContainer");
将ModelLoad方法下的 pages.loadContent(mainPageId, this.getURL(mainPage));
改为this.loadPage(mainPageId, this.getURL(mainPage));
        并添加loadPage方法和修改openPage方法,具体代码如下:
        Model.prototype.loadPage = function(xid,url,fn){
                        var pages = this.comp('pages');
                        var content = pages.getContent(xid);
                        if(!content){
                                content = pages.add({xid: xid});
                        }
                        var parentNode = content.$domNode.get(0);
                        var compose = new WindowContainer({
                                parentNode: parentNode,
                                src: url,
                                onLoad: function(){
                                        fn && fn();
                                        content.on("onActive", function(){
                                                if(compose.getInnerModel()){
                                                        compose.getInnerModel().fireEvent('onActive');
                                                }
                                        });
                                },
                                onLoadError: function(err){
                                        fn && fn(err);
                                }
                        });
                        content.innerContainer = compose;
                }
               
               
                        openPage: function(path, options,fn){
                        if(typeof options == 'function'){
                                fn = options;
                                options = {};
                        }
                        if(typeof path == 'object'){
                                path = path.url;
                        }
                        var me = this;
                        options = options || {};
                        var pages = this.comp('pages'),
                                url = this.getURL(path, options),
                                pid = path;
                        if(!pages.has(pid)){
                                this.loadPage(pid,url,function(err){
                                        if (err){
                                                setTimeout(function(){
                                                        //hcr 特殊点, 必须知道错误对话框的btn
                                                        $("#__justepErrorDialog__").find(".x-error-close").one("click", function(){
                                                                setTimeout(function(){
                                                                        //以下逻辑应该和closePage类似, maduo支持closePage传pid后, 直接调用即可
                                                                        var index = me.openeds.indexOf(pid);
                                                                        if (index !== -1){
                                                                                me.openeds.splice(index, 1);
                                                                        }
                                                                        if (pages.getContent(pid))
                                                                                pages.getContent(pid).dispose();
                                                                });
                                                        });
                                                });
                                        }
                                       
                                });
                               
                                function after() {
                                        pages.to(pid);
                                        me.openeds.push(pid);
                                        me.current = justep.Util.clone(options);
                                        me.current.path = path;
                                }
                                setTimeout(after, 200);
                        }else{
                                fn && fn();
                        }       
                }

如果该问题得到解决,请及时跟帖,以便结贴
回复 支持 反对

使用道具 举报

16

主题

38

帖子

165

积分

初级会员

Rank: 2

积分
165
QQ
 楼主| 发表于 2015-4-17 17:06:27 | 显示全部楼层
已解决,结贴
回复 支持 反对

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-18 12:10 , Processed in 0.109580 second(s), 23 queries .

Powered by Discuz! X3.4

© 2001-2013 Comsenz Inc.

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