This chapter is about the routing section
Again in Init, the code is very small, only this point:
New Router ({ '/:p agename ': function (pageName) { //executes the corresponding route change routemodule.routers (pageName); }. Bind (This)}). Init (' home ');
This is primarily a hash function that is heard by the supervisor and then passed as an argument to the next file, which can be seen as a code for positioning.
What the hash function is, see the tutorial in detail, here is simply the last string of the address bar--
Above, #/rank and #/home is the hash value, representing the rank page and the home page, here is to listen to this type of data, and then passed to the next function, tell the server, now login page is xxx, another, The third party is director.js, passing the object is the router function in the Routemodule module, gave this function passed a parameter.
The writing in Init is basically fixed (simply because I don't know and I don't need to), notice that when the hash value changes, '/:p agename ', the pageName changes at the same time.
Next is the core section, the page jumps.
Building a complete Mobile project-Framing 3