7***@qq.com
7***@qq.com
  • 发布:2021-06-21 18:59
  • 更新:2021-06-21 18:59
  • 阅读:430

预加载界面跳转,监听show事件只能执行一次,后续再进入监听界面,不触发事件

分类:HBuilderX

tab界面
mui.plusReady(function() {
var page = [
'house.html',
'talk_list.html',
'me.html',
'announce.html'
];
var ws = plus.webview.currentWebview();
var styles = {
top: "0px",
bottom: "50px"
};
for (var i = 0; i < page.length; i++) {
var item = plus.webview.create(page[i], page[i], styles);
item.hide();
ws.append(item);
}
plus.webview.show(page[0]);
mui(".mui-bar-tab").on("tap", 'a', function()
{
var href = this.getAttribute("href");
plus.webview.show(href); }

        });  

talk_list.html界面
mui.plusReady(function() {
var self = plus.webview.currentWebview();
self.addEventListener('show',function()
{
console.log('show');
// ... 后续为渲染页面代码
});
})
APP启动时,第一次点击tab按钮,跳转执行一次,后续切换不执行

2021-06-21 18:59 负责人:无 分享
已邀请:

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