Building a complete Mobile project-Framing 3

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.