idon
idon
  • 发布:2016-06-02 14:46
  • 更新:2016-06-03 18:28
  • 阅读:1708

真机运行正常,云端打包后出错 不显示数据,关于链接也打不开。

分类:HTML5+

打包后,数据调用的显示不了,mui.openwindow的也不行,是啥原因。代码如下


<!DOCTYPE html>  
<html>  
<head>  
    <meta charset="utf-8">  
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />  
    <title></title>  
    <script src="js/mui.min.js"></script>  
    <link href="css/mui.min.css" rel="stylesheet"/>      
    <style type="text/css">  
        .mui-bar,.mui-content{font-family: helvetica "微软雅黑";}  
        .ml50{margin-left: 50px;}  
        .pd6{padding: 6px;}  
        .list-title{font-size: 12px}  
        .event-list>li>h4{font-size: 16px;}  
    </style>  
    <script type="text/javascript" charset="utf-8">  
        mui.init();  
        mui.plusReady( function () {  
            //获得当前日期  
            var date = new Date();  
            var year = date.getFullYear();  
            var month = date.getMonth() + 1;  
            var day = date.getDate();             
            var week = ['日','一','二','三','四','五','六'];  
            var weekday = date.getDay();  
            var currDateStr = document.getElementById("currDateStr");  
            var currWeekStr = document.getElementById("currWeekStr");  

            currDateStr.innerHTML = year+'-'+month+'-'+day;  
            currWeekStr.innerHTML = week[weekday];  

            //像jsonp这类的,为避免跨域问题,会通过一个中转页面存储中转  
            //创建新webview  
            var jsonUrl = 'http://api.juheapi.com/japi/toh?key=83e72adb2a6bd888592f2b4bf410e6ca&v=1.0&month='+month+'&day='+day;  
            //plus.nativeUI.toast(jsonUrl);   
            var subPage = plus.webview.create(  
                jsonUrl,  
                'embed',  //表示是嵌套进去  
                {  
                    top:'46px',  
                    bottom:'0px'  
                }  
            );  
            //plus.webview.currentWebview().append(subPage);   这个页面不显示 ,通过getJSON中转存储  

            //将js注入到子页面subPage  
            void subPage.setJsFile('js/getJSON.js');   
            var str = plus.storage.getItem("jsonContent");  
            //转换成json对象  
            var json = JSON.parse(str);  
            //console.log(json.result.length)  

            var currMsgLi = '';   
            mui.each(json.result,function(i){  
                currMsgLi = currMsgLi+"<li class=\"mui-table-view-cell\">"+  
                "<h4>"+json.result[i].title+"</h4>"+  
                "<p>"+json.result[i].des+"</p></li>";   
            });  
            var currMsg = document.getElementById("currMsg");  
            currMsg.innerHTML = currMsgLi;  

            //右上角关于图标  
            var infoLink = document.getElementById("infoLink");  
            infoLink.addEventListener('tap',function(){  

                plus.nativeUI.toast('heha');   
                mui.openWindow({  
                    url: "info.html",  
                    id: "info",  
                    show: {  
                        aniShow: 'zoom-fade-out',  
                        duration: 300  
                    }  
                });  
            });  
        })  
    </script>  
</head>  
<body>  
    <header class="mui-bar mui-bar-nav">  
        <a href="javascript:;" class="mui-icon mui-icon-info-filled mui-pull-right" id="infoLink"></a>  
        <h1 class="mui-title">历史上的今天</h1>  
    </header>  

    <div class="mui-content">  
        <ul class="mui-table-view">  
                <li class="mui-table-view-inverted pd6 list-title">  
                    <span>今天是:</span>  
                    <span id="currDateStr" class="mui-badge mui-badge-blue"></span>  
                    <span class="ml50">星期</span>  
                    <span id="currWeekStr" class="mui-badge mui-badge-red"></span>  
                </li>  
                <li>  
                    <ul class="mui-table-view event-list" id="currMsg">  
                        asfasf  
                   </ul>      
               </li>  
            </ul>  
    </div>    
</body>  
</html>  
2016-06-02 14:46 负责人:无 分享
已邀请:
BoredApe

BoredApe - 有问题就会有答案。

安卓ios?

idon

idon (作者)

安卓上,IOS没测

  • BoredApe

    给我一个能重现问题的测试包

    2016-06-03 09:39

idon

idon (作者)

你好,麻烦了。见附件。

  • BoredApe

    打好的包给一个 apk

    2016-06-03 16:02

idon

idon (作者)

好的,谢谢

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