hnatao
hnatao
  • 发布:2014-10-09 19:33
  • 更新:2014-10-10 13:45
  • 阅读:2403

pagebeforeshow 监听事件没有起作用

分类:MUI
mui

index.html页面有这样一个监控代码,我的app启动默认的页面就是index.html页面,
window.addEventListener('pagebeforeshow', function() {
console.log('ssssss')
});

请问为什么没有打印出“sssss"???

2014-10-09 19:33 负责人:无 分享
已邀请:
DCloud_UNI_CHB

DCloud_UNI_CHB

只有通过mui.openWindow方法打开的窗口,才会触发pagebeforeshow事件;默认首页的启动是通过runtime自己启动的,因此不会触发pagebeforeshow事件;

作为首页,你可以将初始化代码写在mui.plusReady()方法中即可;

hnatao

hnatao (作者)

明白了!

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