6***@qq.com
6***@qq.com
  • 发布:2018-04-30 14:50
  • 更新:2018-05-02 11:31
  • 阅读:1119

我的页面关于预加载问题

分类:HTML5+

我在子页面预加载需要刷新的页面
var page = mui.preload({
url:'web/index.html',
id:'webindex'
});

当我点击注销的时候

var setMealPage = plus.webview.getWebviewById(page.id);
mui.fire(setMealPage, 'refno');
plus.nativeUI.toast('注销成功,5秒自动返回!');
var id = setInterval(function () {
mui.back();
},5000);
获取一下这个预加载的plus.webview.getWebviewById
从而执行mui.fire(setMealPage, 'refno');执行web/index.html的refno监听

在web/index.html中
window.addEventListener('refno', function(e){//执行刷新
alert(2);
//console.log('go index');
location.reload();
document.getElementById('indexHeader').innerHTML = 'Hello World';
});
有监听事件,也alert提示了,但是location.reload()并没有执行 包括document.getElementById('indexHeader').innerHTML = 'Hello World';也没有执行
这个是什么原因 呢?
谢谢

2018-04-30 14:50 负责人:无 分享
已邀请:
hylong

hylong

location.reload();换成plus.webview.currentWebview().reload();试试
另外,修改标题要等到页面loaded以后才能修改,不然可能获取不到对应的dom节点,这样写后台应该会报错吧

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