<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>信息</title>
<link href="../css/mui.css" rel="stylesheet" />
<link href="../css/style.css" rel="stylesheet" />
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-icon mui-icon-left-nav mui-pull-left mui-action-back"></a>
<a href="#offSearch" class="mui-icon mui-icon-search mui-pull-right"></a>
</header>
<div class="mui-class-tabs mui-margin-top">
<ul class="mui-table-view-chevron">
<li class="mui-table-view-cell mui-collapse mui-col-xs-4"><a id="type" class="mui-navigate-right" href="#">类型</a>
</li>
</ul>
</div>
<script src="../js/mui.min.js"></script>
<script type="text/javascript" charset="utf-8">
mui.init();
var subpages = ['vrxxexxal.html', 'dstxxxxxudxxxio.html'];
var subpage_style = {
top: '90px',
bottom: '0px'
};
//创建子页面,首个选项卡页面显示,其它均隐藏;
mui.plusReady(function() {
var self = plus.webview.currentWebview();
for (var i = 0; i < 2; i++) {
var sub = plus.webview.create(subpages[i], subpages[i], subpage_style);
if (i > 0) {
sub.hide();
}
self.append(sub);
}
});
//当前激活选项
var activeTab = subpages[0];
//选项卡点击事件
mui('.mui-segmented-control').on('tap', 'a', function(e) {
var targetTab = this.getAttribute('href');
if (targetTab == activeTab) {
return;
}
//显示目标选项卡
plus.webview.show(targetTab);
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
});
//筛选条件
document.getElementById("type").addEventListener('tap', function(e) {
e.stopPropagation();
if(activeTab == null){
activeTab = plus.webview.currentWebview().children()[1];
}
setTimeout(function() {
activeTab.evalJS('mui("#topPopover").popover("toggle")');
}, 2000);
});
</script>
</body>
</html>
4 个回复
DCloud_UNI_FXY
是子页面webview.evalJS('mui("#popover").popover("toggle");');
Drex (作者)
用的就是这个方法,提示报错
子夜面需要写方法吗?
DCloud_UNI_FXY
贴出来页面完整代码
2015-06-12 15:28
Drex (作者)
DCloud_UNI_FXY
你的activeTab是个字符串(webview id),不是webview,plus.webview.getWebviewById(activeTab).evalJS...
2015-06-12 15:35
Drex (作者)
好像是解决楼,谢谢大神!
2015-06-12 15:41
Drex (作者)
回复 DCloud_UNI_FXY:子页面向父页面传值能用这个函数吗?
2015-06-15 14:49
DCloud_UNI_FXY
回复 Drex:可以。执行js函数,拼写参数执行
2015-06-15 14:55
Drex (作者)
回复 DCloud_UNI_FXY:plus.webview.getWebviewById('center/pl.html').evalJS('document.getElementById("style").innerHTML = "+sssssssssssss+"');这样写对吗?
2015-06-15 15:12
DCloud_UNI_FXY
嗯。是这意思。但是需要注意单双引号的拼写
2015-06-15 16:09
Drex (作者)