mounted: function() {  //使用keep-alive时可以放在activated内
    if (window.history && window.history.pushState) {
        history.pushState(null, null, document.URL);
        window.addEventListener('popstate', this.listenBack, false);
    }           
},
methods: {
    listenBack() {
        if (true) { //必须有,否则可能无法关闭
           //这个可以关闭安卓系统的手机
            document.addEventListener('WeixinJSBridgeReady', function() {
          WeixinJSBridge.call(
'closeWindow');}, false); //这个可以关闭ios系统的手机,顺序不能改变 WeixinJSBridge.call('closeWindow'); } }, beforeRouteLeave(to, from, next) { window.removeEventListener('popstate', this.listenBack, false); }

 

相关文章:

  • 2021-08-14
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-24
  • 2022-12-23
  • 2021-12-09
  • 2022-02-08
相关资源
相似解决方案