如何让底部的tab按钮在pc网页上能切换不同的webview。
而不用plusready方法里设置切换?
这是手机里mui.plusReady方法切换。现在的需求是必须要在网页也能切换。求教
mui.plusReady(function(){
//获得当前页面
var self = plus.webview.currentWebview();
//循环创建子页面
for(var i=0;i<subpages.length;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-bar-tab').on('tap', 'a', function(e) {
var targetTab = this.getAttribute('href');
if (targetTab == activeTab) {
return;
}
//显示目标选项卡
plus.webview.show(targetTab);
//隐藏当前;
plus.webview.hide(activeTab);
//更改当前活跃的选项卡
activeTab = targetTab;
});
2 个回复
chender - 与人为善
pc上没有plus对象,一切和plus相关的逻辑都走不通
雪之梦技术驿站 - 你在互联网的路上匆匆而来,雪之梦技术驿站助你满载而去
pc无plus对象 需要用h5的方法自己实现 试试iframe
r***@126.com (作者)
嗯,这也是个办法,有没有其他的更好的办法?
2017-08-03 10:06