onReady() {
// #ifdef APP-PLUS
var currentWebview = this.$mp.page.$getAppWebview(); //获取当前页面的webview对象,此对象相当于html5plus里的plus.webview.currentWebview()
setTimeout(function() {
wv = currentWebview.children()[0];
wv.addEventListener('loaded',e =>{
wv.canBack(e =>{
console.log('是否可返回:'+e.canBack);
currentWebview.setTitleNViewButtonStyle(0, {
width: e.canBack ?'44px':'0',
});
});
});
// wv.onloaded = () => {
// 拦截所有页面跳转,可使用参数拦截weibo.com域名之外的跳转({mode:'allow',match:'.*weibo\.com/.*'})
// wv.overrideUrlLoading({ mode: 'allow',match:'' }, function(e) {
// console.log('************url: '+e.url);
// });
// };
}, 1000); //如果是页面初始化调用时,需要延时一下
// #endif
},
怎么这种监听不到啊?我的需求是在一级页面的时候在导航栏不显示返回按钮,进入里层页面才显示?