打包后,数据调用的显示不了,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>
4 个回复
BoredApe - 有问题就会有答案。
安卓ios?
idon (作者)
安卓上,IOS没测
BoredApe
给我一个能重现问题的测试包
2016-06-03 09:39
idon (作者)
你好,麻烦了。见附件。
BoredApe
打好的包给一个 apk
2016-06-03 16:02
idon (作者)
好的,谢谢