使用 var title = this.getAttribute('title'); 方式在首页动态获取子页面的标题名称,来设置子页面的原生title,打开子页面后,在IOS版本中偶尔回出现空白的情况,Android版本没有问题。请问是什么原因造成的呢?现在是一头雾水啊。。。。
代码如下:
//主列表点击事件
mui('body').on('tap', 'a', function() {
var id = this.getAttribute("data-id");
var catid = this.getAttribute("data-catid");
var title = this.getAttribute('title');
var href = this.getAttribute('href');
mui.openWindowWithTitle({
url:href,
id:href,
styles:webview_style,
extras:{
catid:catid,
contentid:id
},
show:{
event:"loaded",
extras:extras
},
waiting:{
autoShow:false,
}
},{
title:{
text:title
},
backgroundColor:"#ffffff",
bottomBorderColor:"#dddddd",
back:{
image:{
base64Data:BACK_IMG
}
}
});
});
独孤雄鹰 (作者)
是这样,在第一次打开子页面时,可以显示标题名称,证明是可以获取成功的,但是关闭子页面再重新打开就变成空白了,重复几次有可能又显示了。
2018-01-17 12:03