Home>Article>Web Front-end> How to use mock JQuery

How to use mock JQuery

藏色散人
藏色散人 forward
2020-06-12 14:10:25 3133browse

Mock JQuery basic use

mock.js

  • Random number

Seven Big rules

Random function

Regular

  • Block ajax

  • Instance

let stdents = Mock.mock({ "list|30": [{ "学号|+1": 1, name: "@cname", "gender|1": ["男", "女"], "成绩|50-100": 1, "班级|1-10": 1, }] }) Mock.mock(url,type,function({url,type,body}){ //具体服务器模拟代码 return "需要返回的数据": })

Related recommendations: "javascript basic tutorial"

JQuery

JQuery : Operation, Events, animations, ajax4

Core functions:

  • If a selector in string format is passed in, all elements that meet the conditions will be selected on the page and packaged. Their JQuerry objects;

  • If you pass in a label in html format in string format, the node corresponding to the label will be created, but! And get the JQuerry object that wraps them;

  • #If a function is passed in, the effect is similar to window.onload, window is always first, and JQuerry is slow. In fact, it is the abbreviation of document.ready().

  • #Others, directly encapsulate the JQuery object.

¥copy=$ul.clone(true,false), the first one represents the cloning event, and the second one represents the son cloning event.

Chain call: In all cases where the return value is uncertain, return the JQuerry object just now

The above is the detailed content of How to use mock JQuery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete