Category:JavaScript

  • Three definition methods of JS function

    Time:2021-7-30

    How functions are defined Function declaration: it must have a name. It will promote the function. It has been created in the pre parsing stage. It can be called before and after the declaration //Function declaration //Define function name function fn(){ console.log(123); } Function expression: a variable assignment function expression can have no name (anonymous […]

  • JS function calling mode and this analysis

    Time:2021-7-29

    Function call and this ① Ordinary function calls are executed by adding () to the function name or variable name. function fn(){ console.log(1); }; fn(); ② Constructor, called through the new keyword (you can also call with (), but the function is incomplete) function Student(name){ this.name = name; }; var s1 = new Student(“li”); ③ […]

  • How to implement Ajax delay sending and send Ajax requests after idle

    Time:2021-7-29

    Many times, we will encounter functions such as keyword search Our first idea is to bind the Keyup event of the response, and then request an Ajax to return the data processing of the response However, at this time, if you simply bind the Keyup event. So, each keystroke will send an Ajax request, which […]

  • Explain the instruction module and style of angular structure in detail

    Time:2021-7-29

    catalogue 1、 Structured instruction Two, module Module Write a forroot () 3、 Style definition Use ngstyle to adjust the order when dragging 1、 Structured instruction *Is a syntax sugar, < A * ngif = “user. Login” > Exit < / a > is equivalent to <ng-template [ngIf]=”user.login”> <a>Exit</a> </ng-template> Avoid writing ng template. <ng-template [ngIf]=”item.reminder”> […]

  • Building multi page programs using webpack

    Time:2021-7-28

    It is very common to use webpack to build single page programs, but we may need to develop multi page programs in actual development. Therefore, I studied how to use webpack to build multi page programs. principle Consider the folder where each page is located as a separate single page program directory, and configure multiple […]

  • Analyze the compatibility between the creation of Ajax core XMLHttpRequest object and browser

    Time:2021-7-28

    Mlhttprequest object is the core of Ajax function. To develop Ajax programs, we must start with understanding XMLHttpRequest object. To understand the XMLHttpRequest object, start by creating the XMLHttpRequest object. Create the XMLHttpRequest object in different browsers using different methods: Let’s first look at IE’s method for creating XMLHttpRequest object (method 1):  var xmlhttp=ActiveXobject(“Msxml12.XMLHTTP”);// Create […]

  • Detailed explanation of angular parent-child component communication

    Time:2021-7-28

    catalogue summary 1、 Overview of input and output properties 2、 Input properties 3、 Property binding is one-way, from parent component to child component 4、 Output properties 1. First, simulate a real-time changing IBM stock price 2. Output the information and tell the external components who are interested and who will subscribe 3. Receive and display […]

  • Analysis and application of call, apply and bind methods in JS

    Time:2021-7-27

    call Function of call () method: specify this of the function, execute the function and pass parameters Parameters: fn.call(thisArg,arg1,arg2,ar3,……) Thisarg specifies the object to which this points. If null or undefined is specified, the internal this points to window Arg1, arg2, Ar3,… Parameter list The return value is the return value of the function itself […]

  • Example of Ajax file upload effect implemented by iframe

    Time:2021-7-27

    Copy codeThe code is as follows: < span style = “font family: Verdana, ‘Ms song’, Arial, Microsoft YaHei, Helvetica, sans serif; font-size: 14px; line-height: 21px; text-align: left; background-color: rgb(255, 254, 247); “> Avascript section</span> Copy codeThe code is as follows: <!doctype html> <html> <head> <meta charset=utf-8> <head> < title > Ajax file upload ~ ~ […]

  • Vue2 implements provide inject transfer response

    Time:2021-7-27

    1. Conventional writing in vue2 //Parent component provides’ foo ‘ var Provider = { data(){ return { foo: ‘bar’ } } provide: { Fooprovide: this. Fofn // pass a function of reference type }, methods:{ fooFn() { return this.foo } } } var Child = { inject: [‘fooProvide’], computed:{ fooComputed(){ Return this. Fooprovide() // because […]

  • JS function arguments and application of higher order functions

    Time:2021-7-26

    Function member – arguments Arguments: the collection of all arguments (class array object) passed in when the function is called Arguments. Callee: an attribute of arguments that points to the function itself Function name. Caller: the caller of the function. If it is called globally, the returned caller is null. Function name. Length: number of […]

  • Ajax smart tips + textbox dynamically generate drop-down box example code

    Time:2021-7-26

    Copy codeThe code is as follows: < div > quick query: < select runat = “server” > < option value = “1” selected = “selected” > by inner tube code < / option > < option value = “2” > by tag code < / option > < / Select > < / div >< […]