启动错误
启动错误
  • 发布:2015-03-26 16:26
  • 更新:2015-03-31 00:37
  • 阅读:8942

如何在子页面修改父窗口的标题内容

分类:MUI

//处理右上角关于图标的点击事件;
var subWebview = null,
template = null;
document.getElementById('info').addEventListener('tap', function() {
if (subWebview == null) {
//获取共用父窗体
template = plus.webview.getWebviewById("default-main");
}
if(template){
subWebview = template.children()[0];
subWebview.loadURL('examples/info.html');
//修改共用父模板的标题
mui.fire(template, 'updateHeader', {
title: '关于',
showMenu: false
});
template.show('slide-in-right', 150);
}
});
demo演示里面的代码,获取不到共用的父窗体

2015-03-26 16:26 负责人:无 分享
已邀请:
荼蘼

荼蘼

default-main 父窗口的ID改成自己的。
监听自定义事件
window.addEventListener('customEvent',function(event){
//通过event.detail可获得传递过来的参数内容
....
});
触发自定义事件
mui.fire(targetPage,'customEvent',{
//自定义事件参数
});

unicorn_up

unicorn_up

jQ :(

stk_tianwen

stk_tianwen

没看明白怎么弄的。
index.html中在初始化的时候是没有ID的。
这样加载了list.html子页面以后,list.html的内容刷新了,需要修改index.html页面的标题。
这怎么弄?
通过什么获取index.html页面对象?

  • stk_tianwen

    这个时候,index.html窗口通过plus.webview.getLaunchWebview() 获取。

    2015-03-30 21:25

smallBlackCats

smallBlackCats

@stk_tianwen
获取启动界面(index.html) 的 webview对象有两种方法,自己找的,这两个获取到的对象是一致的

plus.webview.getLaunchWebview()  
plus.webview.getWebviewById(plus.runtime.appid)
  • 南宫萧尘

    感谢,帮了我大忙,谢谢!

    2016-01-10 19:28

该问题目前已经被锁定, 无法添加新回复