vue listening return

Mounted: function () {   // may be placed in the use of activated-Alive Keep 
    IF (the window.history && window.history.pushState) { 
        history.pushState ( null , null , document.URL); 
        window.addEventListener ( 'the popstate ', the this .listenBack, false ); 
    }            
}, 
Methods: { 
    listenback () { 
        IF ( to true ) { // must have, or may not be closed 
           // this can turn off the phone Android system 
            document.addEventListener (' WeixinJSBridgeReady ', function () {
          WeixinJSBridge.call (
'closeWindow');}, to false ); // This ios can turn off the phone system, the order can not be changed WeixinJSBridge.call ( 'closeWindow' ); } }, beforeRouteLeave (to, from, Next) { window. the removeEventListener ( 'the popstate', the this .listenBack, to false ); }

 

Guess you like

Origin www.cnblogs.com/linjiangxian/p/11460831.html