<script type="text/javascript">
var ws = null, wo = null, page = 1;
window.onload = function(){
mui.init();
mui.plusReady(function(){
ws = plus.webview.currentWebview();
wo = ws.opener();
page = ws.dataId;
mui('body').on('tap', 'a', function(e) {
var id = this.getAttribute('href');
var type = this.getAttribute('open-type');
if (id) {
if(~id.indexOf('.html')) {
mui.openWindow({
id: id,
url: this.href,
preload: true
});
} else {
if (typeof plus !== 'undefined') {
plus.runtime.openURL(id);
}
}
}
});
plus.nativeUI.showWaiting();
ajax();
mui.back = function(){
mui.openWindow({
id: 'glhd.html',
url: 'glhd.html',
preload: true
});
setTimeout(function(){
plus.webview.currentWebview().close();
},300);
}
});
}
var ajax = function(){
var url = plus.storage.getItem('ip') "wetlandpark/page/News_appDetail.action";
var type = "get";
var dataType = "json";
var data = {
id:ws.dataId
}
mui.getJSON(url, data, function(d){
plus.nativeUI.closeWaiting();
if(d.result == '00'){
document.querySelector('#newcon').innerHTML = '<h2 class="ne-tit">' d.title '</h2><span class="ne-con-tip">(时间:' d.time ' 点击:' d.clicknum ')</span><div class="ne-con">' d.content '</div>'
}else{
alert("数据获取失败!");
}
});
}
</script>
6 个回复
DCloud_UNI_FXY
贴一下你的详情页代码
lafer (作者)
DCloud_UNI_FXY
你这个详情页是预加载模式?不要把取数据放在onload里边,预加载的话只会onload一次。
你应该在pagebeforeshow事件里重新加载新的数据
lafer (作者)
好的 我试一下
DCloud_UNI_CHB
你也可以在每次打开详情页面时,通过自定义事件触发详情页面获取对应的详情;
参考mui自定义事件,其中有列表到详情的示例;
lafer (作者)
好的 谢谢帮助