hbuilder + vue packaged into a single-page application APP Back button to return to the previous question

APP packaging tool: hbuilder

Js required package: mui.js, introduction method https://www.cnblogs.com/v616/p/11290281.html

The principle: listening Andrews machine vue root component App.vue, press the Back button when vue routing path

Code App.vue

Fragment: 
Data () { 
    return { 
      tabbarShow: to true, 
      arrTab: [ '/ Home', '/ CAT', '/ History', '/ Me'] 
    }; 
  }, 
  Mounted () { 
    // Andrews Backspace 
    this . mui.plusReady $ (() => { 
      var backcount = 0; 
      the this mui.back = $ () => {. 
        the let the this path = $ route.path;. 
        the console.log ( "path:" + path); 

        IF (this.arrTab.includes (path)) { 
          // main navigation page 
          (. mui.os.ios the this $) IF return; 
          IF (backcount> 0) { 
            IF (window.plus) plus.runtime.quit () ; 
            return; 
          }; 
          . Toast the this $ ( 'click again to exit the application!');
          ++ backcount; 
          setTimeout( () =>{
            backcount = 0; 
          }, 2000); 
        } the else { 
          // subpages 
          console.log ( 'sub-page back button'); 
          . $ router.go the this (-1); 
        } 
      }; 
    }) 
  },

  

Guess you like

Origin www.cnblogs.com/v616/p/11294531.html