Use mock.js to make front-end development independent of back-end
Function implemented by Mock.js.
Generate data based on data templates.
Generate data based on HTML template.
Intercept and simulate Ajax requests.
This article only demonstrates using mock.js to simulate and intercept Ajax requests.
First of all, quote in the page:
1 2 |
|
Define DIV:
1 2 3 |
|
The JS code is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
|
The running rendering is as follows:
You can see from the above rendering that the data is different every time.
If you want to know more Mock commands, you can check out the Mock.js official website: http://mockjs.com/
The above is just an introduction.
In order to make system management and use more convenient, everyone can learn about Ali RAP.
RAP is a visual interface management tool that analyzes the interface structure, dynamically generates simulation data, verifies the correctness of the real interface, and improves our collaboration efficiency through a series of automated tools around interface definition. Our slogan: Be more efficient and get home for dinner!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

