vue-router routing mode

  vue-router three route patterns: hash, history, abstract;

    hash: browser environment, use URL hash values ​​do routing; support all browsers, including not support HTML5 History Api browser;

    history: dependence HTML5 History API and server configuration;

    abstract: Supports all javaScript operating environment, such as node.js server; if no browser API found that the route will be automatically forced into this mode;  

 

  vue Source:

switch (mode) {
    case  'history' : 
       this.history = new HTML5HIstory(this, option.base)
       break
    case   'hash' : 
       this.history = new HashHistory(this, option.base,  this.fallback)
       break
    case 'abstract' : 
       this.history = new AbstractHistory(this, options.base)
       break
    default : 
       if (process.env.NODE_ENV !== 'production') {
           assert(false,  `invalid mode : ${mode}`)
       }
}         

 

Guess you like

Origin www.cnblogs.com/mufc/p/11288023.html