RAP2 dummy data before and after use to achieve the analog end of the separation

First, why use RAP2
in the case of a development project, it requires the use of large amounts of data generated before rendering the interface back-end developers may not have finished in the page, there is no back-end data to support the front-end, we use mock. js (mock.js for generating random data, intercept ajax request) simulation false data to achieve separation of front and rear ends. Development, we can also use RAP2 (there is data generated based on mock.js) analog false data online.

Second, some learning about RAP2 URL
mock.js URL
RAP2 URL
RAP2 official document
mock.js syntax specification documents

Three, RAP2 using procedure

  1. RAP2 URL into the account after successful registration, we first create a project warehouse, as shown below:
    Here Insert Picture Description

  2. After the warehouse built, we enter the warehouse, click New InterfaceHere Insert Picture Description
    Here Insert Picture Description

  3. New Interface is completed later, we can see as shown below, click on our product list, you can request the right to set parameters, and the response content (click on the Edit button), right there an address, click on the address, after entering the content shown inHere Insert Picture Description
    Here Insert Picture Description

  4. The next parameter setting request and response parameters, where in response to parameters of example, in response to the right click to create new content response property, as shown below:
    Here Insert Picture Description

  5. Depending on the type of data created, appears at the left as shown in "+" sign pic_8, click on the "+" sign may be added to its interior properties,
    FIG pic_8 response data generated in accordance with generation rules fill. [7 format has generated rules, rules can be viewed on generating links mock.js syntax specification document] the beginning of the article, such as drawing data generation rules attribute to 9, represents the nine generating elements. generation rule id attribute 1-9999, 1-9999 represent the random numbers generated.
    Here Insert Picture Description

  6. mock.js mock.random document on the method called "placeholder" in the template data, the writing format @ placeholder (parameter [parameter]), can be used in setting the initial value, randomly generates a content.
    Here Insert Picture Description

  7. If we want to define their own data if you skip 5 and 6. Depending on the type of data created, appears at the left as shown in "+" sign pic_8, click on the "+" sign may be added to its interior properties, fill out the generated response data generation rules. Tip: Data type String, or custom data will not be executed; +1 generation rules, otherwise it will not execute Oh!
    Here Insert Picture Description
    Here Insert Picture Description
    Well, a simple analog data is complete, you can try Oh!

Guess you like

Origin blog.csdn.net/qq_42363090/article/details/93505301