Home > Web Front-end > JS Tutorial > How to use mock JQuery

How to use mock JQuery

藏色散人
Release: 2020-06-12 14:11:20
forward
3256 people have browsed it

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 "需要返回的数据":
})
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template