MVC.Router

Router used to route url to responding action callbacks.

parents: Base

defined in: router.js

Class

Attributes

  • routes {Object} Route and action config.

Methods

  • addRoutes (routes) Add config to current router.
  • MVC.Router. navigate (path, opts) <static> Navigate to specified path.
  • MVC.Router. start (opts) <static> Start router (url monitor).

Class Detail

  • MVC.Router ()
    Router used to route url to responding action callbacks.

Attributes Detail

  • routes {Object} Route and action config.
    Example
    • 
        {
          "/search/:param":"callback"
          // or
          "search":{
            reg:/xx/,
            callback:fn
          }
        }
      

Methods Detail

  • addRoutes (routes) view source
    Add config to current router.
    Parameters
    •   routes {Object} Route config.
    Example
    • 
        {
          "/search/:param":"callback"
          // or
          "search":{
            reg:/xx/,
            callback:fn
          }
        }
      
  • MVC.Router. navigate (path, opts) <static> view source
    Navigate to specified path.
    Parameters
    •   path {String} Destination path.
    • [ opts ] {Object} Config for current navigation.
    •   opts.triggerRoute {Boolean} Whether to trigger responding action even current path is same as parameter
  • MVC.Router. start (opts) <static> view source
    Start router (url monitor).
    Parameters
    •   opts {object}
    •   opts.success {Function} Callback function to be called after router is started.
    •   opts.urlRoot {String} Specify url root for html5 history management.
    •   opts.nativeHistory {Boolean} Whether enable html5 history management.
blog comments powered by Disqus
Top