Tag:function

  • State, mutation, action, getter and module of vuex

    Time:2020-12-1

    Describe the use and relationship of state, mutation, action, getter and module of vuex,Give examples to illustrate how they are used. 1. Store data state global data as long as it is changed, all the places used will change2. Change data (synchronous) mutation change state by submitting commit3. Change data (asynchronous) action can not be […]

  • Prototype and prototype chain

    Time:2020-12-1

    JavaScript has objects everywhere. Yes, JavaScript is everywhere. So it must have a mechanism to connect all objects. So Brendan EICH finally designed “inheritance.”. Since we want to understand prototypes and prototype chains, we need to understand why we invented prototypes first? So we understand why prototypes were invented, and what is a prototype? In […]

  • Redux

    Time:2020-12-1

    Redux learning technological process Store distribution (dispatch) > action (type indicates the action to be performed) > pure function of reducer, which accepts the previous state and action and returns the new state (switch)( action.type )Case performs different operations according to the type type, thus changing the state) action cart-actions.js export const ADD_TO_CART = ‘ADD_TO_CART’; […]

  • JavaScript animation function encapsulation

    Time:2020-12-1

    Simple animation function: animate(obj, target, time, callback); be careful: obj: target object, need to addAbsolute positioning target: target location time: animation interval callback: callback function Code implementation: function animate(obj, target, time, callback) { //First clear the previous timer, and only keep the current timer execution clearInterval(obj.timer); obj.timer = setInterval(function() { //The step value is written […]

  • Dealing with sudden failure of public CDN

    Time:2020-12-1

    Use of public CDN When I started to develop my blog, I used bootcdn and found that they were hacked. Although we want to scold those “hackers”, we have no way to prevent them. We can only solve the problem from our own website. At that time, I didn’t have the technology to solve this […]

  • Hand in hand teaching you react beginner

    Time:2020-12-1

    To build the react environment, first install the create react app scaffold. Use the create react app project name. Create a react project NPMI initialization project NPM start project 2. Make clear the state management of react React is a state machine. What is the embodiment? It is reflected in the state. Through the interaction […]

  • After watching JavaScript – XHR to realize SMS verification function, I was overjoyed

    Time:2020-12-1

    Is JavaScript complex to implement SMS captcha? After reading this JavaScript – XHR SMS verification function, you will know how simple it is. This article uses the interfaces of SMS providers in various cloud markets as a demonstration example. The code is as follows:`var data = “appId=41KYR0EB&appKey=IIWCKKSR7NOQ&phone=1561894**&templateId=1043&variables=1234″; var xhr = new XMLHttpRequest();xhr.withCredentials = true; xhr.addEventListener(“readystatechange”, […]

  • 2020python exercise 12 — function objects and closure functions (1)

    Time:2020-12-1

     @2020.3.20  1. Code practice of multi branch if optimized by function object def foo(): print(‘foo’) def bar(): print(‘bar’) dic={ ‘foo’:foo, ‘bar’:bar, } while True: choice=input(‘>>: ‘).strip() if choice in dic: dic[choice]()   2. Write the counter function, call one time, add one on the original basis reminder: 1: Need to use knowledge: closure function + […]

  • The learning diary of flutter (3)

    Time:2020-12-1

    The life cycle of flutter There are two main types of flutters: stateless stateless widget and stateful stateful widget 1. StatelessWidget A stateless widget cannot be changed, such as icon, text, etc. Because it cannot be changed, there is no life cycle. 2. StatefulWidget A stateful widget is stateful and mutable. A stateful widget component […]

  • Best of the year sync.Map Detailed explanation

    Time:2020-12-1

    In our work, we often encounter the situation that the map is read and written concurrently, which results in the panic. Why do we have the panic when reading and writing the map concurrently? Because in the case of concurrent read and write, the data in the map will be written disorderly, and thenGarbage in, […]

  • Why does Python have a pass statement?

    Time:2020-12-1

    This article is from the “why Python” series, please check out the full article About PythonpassStatement, it seems to be very simple (only 4 letters), even beginners without any programming experience can quickly master its usage. The introduction of the official document is very simple. The following three examples can help us quickly understand how […]

  • Simple implementation of route routing based on PHP framework

    Time:2020-12-1

    Parameter larravel routing usage to emulate a simple routing implementation class Route { /** * @var $_ Instance // instance */ private static $_instance = null; /** * @var $_ CurrentPath // address in current URL */ private $_currentPath = ”; /** * @var $_ Prefix // prefix in URL address */ private $_prefix = […]