Function anti chattering and function throttling
Use throttling anti chattering function (Performance Optimization)
So how to use it in vue:
In public methods (such as untils.js), add function anti shake and throttling methods
// Anti shake
export function _debounce(fn, delay) {
var delay = delay || 200;
var timer;
return function () {
var th = this;
var args = ...
Added by Tensing on Sat, 29 Jan 2022 00:26:03 +0200
Vue3+Typescript(coderwhy) super detailed learning notes vue3 development basic syntax
(pay attention to whether I can accept the update push)
I Knowledge supplement
1.1. (understand) this in methods
1.1.1. Arrow functions cannot be used
If we want to use data to return the data in the object in methods, this must have a value, and the data in the data return object should be available through this.
So can this be a windo ...
Added by zirius on Fri, 28 Jan 2022 22:39:02 +0200
[front end] refactoring, tasteful code 02 -- building a test system
Write in front
Code refactoring is an inevitable work in the process of product continuous function iteration. The so-called refactoring is to optimize and adjust the internal implementation without changing the input and output of the program, that is, ensuring the existing functions. This is the second article in the "refactoring, taste ...
Added by able on Fri, 28 Jan 2022 17:24:10 +0200
Vue custom instruction
1. Custom instruction registration
User defined instructions can only be used after registration. Vue provides two registration methods:
Global registration: Vue directive(id, [definition])๏ผ ID: instruction name, [definition]: user-defined object or function object. The function to be realized by the instruction is defined in this object.Loc ...
Added by DwarV on Fri, 28 Jan 2022 16:54:46 +0200
Event binding, event propagation, event capture, event bubbling, custom event
There are three levels of DOM events
DOM level 0 events DOM0 level time can be divided into two types: one is to directly add execution statements in the tag, and the other is to define execution functions.
<input type="text" id="test">
<input type="button" value="button" onclick="alert(document.getElementById('test').value)">
&l ...
Added by nocniagenti on Fri, 28 Jan 2022 16:05:47 +0200
Generic of [Typescript Introduction Manual]
Generic of [Typescript Introduction Manual]
๐ [TypeScript Introduction Manual] records the concept of Ts with high attendance, which is designed to help you understand and be familiar with Ts ๐ This series will continue to be updated and corrected, focusing on the points you are interested in. Welcome to leave messages and exchange, and ...
Added by jmrouleau on Fri, 28 Jan 2022 12:35:34 +0200
ECMAScript Module and CommonJS learning notes
Note: esm below refers to ECMAScript Module, that is, the module syntax of ES6 (import/export), and cjs refers to CommonJS (module.exports/require)
Browser side ESM module loading
When the browser uses the esm module syntax to import/export or load the ES6 module through the script tag, type="module" must be added so that the browse ...
Added by dila125 on Fri, 28 Jan 2022 12:19:12 +0200
There are so many differences between for loop and forEach in JavaScript!
There are so many differences between for loop and forEach in JavaScript!In normal work, there are several ways to loop through the array, but the most commonly used should be the for loop and the forEach method using the array.Today, let's fully compare the difference between the two. Please watch it.First, we define two arraysconst arr1 = ['a ...
Added by YodaOfCamarilla on Fri, 28 Jan 2022 12:19:09 +0200
Three.js - voice module
13. Voice module
13.1 association between audio and scene (sound source and listener)
Threejs provides a series of Audio related API s: Audio audio, position Audio, listener AudioListener, Audio analyzer, Audio loader, AudioLoader.
Threejs classes such as Audio, location Audio and PositionalAudio essentially encapsulate the native Web Au ...
Added by andy1398 on Fri, 28 Jan 2022 11:51:05 +0200
Inheritance in js
To realize inheritance, we first need a parent class. In js, there is actually no concept of class. In es6, although class is very similar to class, it is actually just a syntax sugar in es5
Prototype chain inheritance
The instance of the parent class is used as the prototype of the child class
function Woman(){
}
Woman.prototype= new Peopl ...
Added by mikegzarejoyce on Fri, 28 Jan 2022 11:16:07 +0200