Webpack custom plug-in writing

When writing a custom plug-in, you need to know that the webpack plug-in consists of the following: A JavaScript named function or JavaScript class.Define an apply method on the prototype of the plug-in function.Specify an event hook bound to the webpack itself.Process specific data for webpack internal instances.Call the callback provided by ...

Posted by Smasher on Fri, 20 May 2022 00:03:21 +0300

[R1-2]this,call,apply

1. this Except for the less commonly used with and eval, the pointers of this are roughly divided into the following four types: Use as a method of an object Called as a normal function Constructor use Function.prototype.call and Function.prototype.apply calls 1.1 Method calls as objects When a function is called as a method of an object, thi ...

Posted by Rob the R on Thu, 19 May 2022 17:36:13 +0300

Useful JavaScript code snippets

Share a practical JavaScript code fragment to help you quickly complete your development tasks maxItemOfArray 1. This function can return the maximum value of an array. const maxItemOfArray = (arr)=>[...arr].sort((a,b)=>b-a).slice(0,1)[0] let maxItem = maxItemOfArray([0,23,23,23,4,5,2]) areAllEqua 2. This code can check whether all ite ...

Posted by chuckjones on Thu, 19 May 2022 15:54:10 +0300

Say goodbye to code redundancy! Teach you how to write if else gracefully

preface:When we write js code, we often encounter complex logic judgment. Usually, you can use if/else or switch to realize multiple conditional judgment, but there will be a problem. With the increase of logic complexity, the if/else/switch in the code will become more and more bloated, and the readability will become worse and worse, so we ca ...

Posted by seanrock on Thu, 19 May 2022 09:17:19 +0300

Big front-end advanced - isomorphic application

Overview In the front-end field, with the popularity of Vue, React, Angular and other frameworks, front-end engineering and modularization have become the mainstream technical solutions. The SPA single-page application built by this type of framework has the advantages of good user experience, good rendering performance, and high maintainabilit ...

Posted by PhantomCode on Thu, 19 May 2022 03:51:44 +0300

Study Notes Seven DOM

DOM manipulation of CSS Read and modify inline styles 1. Use the style attribute to manipulate the inline style of an element - Read inline styles: Syntax: element.style.style name - example: element.style.width element.style.height - Note: if the style name has-,you need to change the style name to camel case Will-remove, ...

Posted by Duje_KH on Thu, 19 May 2022 03:17:02 +0300

Use of deconstruction in js (variable deconstruction, parameter deconstruction)

Deconstruction in JS **Statement: * * article taken from Crazy technology house Front end stack Sunny trees This article is a learning record based on the contents of predecessors. Deconstruction and use of variables The deconstruction of variables is mainly used to read, access and operate some attributes or values. Here are five common var ...

Posted by mark_18 on Wed, 18 May 2022 23:15:41 +0300

Thoroughly understand closures through examples

Thoroughly understand closures through examples In JS, closure and asynchrony are called two major difficulties. What is a closure and what is the function of a closure? Before we talk about closures, let's take a look at variable scope. There are two types of variables according to their scope: global variables and local variables. There are m ...

Posted by qartis on Wed, 18 May 2022 17:19:58 +0300

Multi selection and multi page echo of Table in element UI

Because vue has been used in the development project+ Element-ui So today, let's talk about the problem of multi page echo data when using multi selection of Table (element UI official website: https://element.eleme.cn/#/zh-CN) If you don't have much to say, first post the Table multi-choice Table code given by the element UI official website ...

Posted by BizBoy on Wed, 18 May 2022 11:31:10 +0300

Simple understanding of ES6 Promise

Simple understanding of ES6 PromiseforewordPromises are a solution to asynchronous programming: syntactically, a promise is an object from which you can get messages for an asynchronous operation; in its original sense, it's a promise that promises to give you a result after a period of timePromise s can ensure that asynchronous requests become ...

Posted by hack4lk on Wed, 18 May 2022 11:23:02 +0300