账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    小程序webview嵌套H5没有返回按钮,如何解决?
    37
    0

    小程序内放置一个<web-view>组件来链接HTML页面了,导航栏没有返回按钮,有什么好的办法解决。
    自定义状态栏,然后状态栏上加一个返回图标,点击小程序返回图标能调用H5页面this.$router.go(-1)方法吗?

    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 10 元积分
        全部回答
    • 0
    • 小程序webview嵌套H5没有返回按钮可能是因为在H5中设置了window.onpopstate事件监听器,但是没有在webview中设置window.onpopstate事件监听器。你可以通过以下步骤解决这个问题:

      1. 在H5中设置window.onpopstate事件监听器:

      javascript window.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); });

      1. 在webview中设置window.onpopstate事件监听器:

      javascript window.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); }); window.webview.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); });

      1. 在H5中设置window.onpopstate事件监听器,但是没有在webview中设置:

      javascript window.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); }); window.webview.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); });

      1. 在H5中设置window.onpopstate事件监听器,但是没有在webview中设置,并且没有使用window.webview变量:

      javascript window.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); }); window.webview.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); });

      1. 在H5中设置window.onpopstate事件监听器,但是没有在webview中设置,并且没有使用window变量:

      javascript window.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); }); window.webview.addEventListener('popstate', function(e) { console.log('Popstate event received:', e); });

      以上就是解决小程序webview嵌套H5没有返回按钮的问题的几种方法。

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部