7***@qq.com
7***@qq.com
  • 发布:2016-04-22 10:41
  • 更新:2016-04-22 17:04
  • 阅读:1885

显示找不到detailPage页面,咋回事?

分类:MUI

mui(".mui-table-view").on('tap', '.mui-table-view-cell', function() {  
                    //获取id  
                    var id = this.getAttribute("id");  
                    console.log("打印:" id);  
                    if (!detailPage) {  
                        detailPage = plus.webview.getWebviewById('helpSub.html');  
                        console.log("打印:" detailPage.id);  
                    }  
                                   mui.fire(detailPage, 'getDetail', { id: id });  
                    //打开新闻详情  
                    mui.openWindow({  
                        id: 'helpSub.html',  
                        url: 'helpSub.html'  

                    });  
2016-04-22 10:41 1 条评论 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

贴完整代码

7***@qq.com

7***@qq.com (作者)

<script type="text/javascript" charset="UTF-8">

        var baseUrl = "http://192.168.0.130:8080/donkeyBus";  
        mui.init({  
            preloadPages:[{  
                    url: "helpSub.html",  
                    id: "helpSub.html"  
            }]  
        });  
        var detailPage = null;  

        mui.plusReady(function() {  
            mui.ajax(  
                baseUrl + "/help/getHelpInfo",  
                {  
                dataType:'json',//服务器返回json格式数据  
                type:'post',//HTTP请求类型  
                timeout:10000,//超时时间设置为10秒;  
                success:function(data){  
                    $("#help_ul").empty();  
                    $(data).each(function(i) {  
                        if(data[i].type == 1 && data[i].parentId == 0 ){  
                            var html = '<li id="' + data[i].id + '" class="mui-table-view-cell mui-group-list-item"> ' + data[i].title +' </li>';  
                            console.log(html);  
                            $("#help_ul").append(html);  
                        }  

                    });  
                },  
                error:function(xhr,type,errorThrown){  
                    //异常处理;  
                    console.log("zzzzzzzzzzzzzz");  
                }  
                });  

            /*  
             点击列表,获取列表id,并将id传给helpSub详情页面,然后打开新页面  
             */  
            mui(".mui-table-view").on('tap', '.mui-table-view-cell', function(e) {  
                //获取id  
                var id = this.getAttribute("id");//得到每行的id  
                var type = this.getAttribute("type");//每行的type  
                var parentId = this.getAttribute("parentId");//每行的parentId  

                console.log("打印"+this.getAttribute("type"));  

                if (!detailPage) {  
                    detailPage = plus.webview.getWebviewById('helpSub.html');  

                }  

                //传值给详情页面,通知加载新数据  
                mui.fire(detailPage, 'getDetail', { id: id });  
                //打开新闻详情  
                mui.openWindow({  
                    id: 'helpSub.html'  

                });  
            });  

            function: bandEvent(id){  
                console.log(":"+id);  

            }  
        });  

    </script>  

页面会跳转了,但是 下面的
var type = this.getAttribute("type");//每行的type
var parentId = this.getAttribute("parentId");//每行的parentId
的不到type 和parentId。
我需要根据type的值来判断输出的内容

holy1004

holy1004

console.log("打印:" detailPag.id);是这句话报错吗?

该问题目前已经被锁定, 无法添加新回复