• Welcome to Baben's blog that year. I'm glad to meet you at the right age!
  • Due to the theme, the QQ login partner displays the default avatar in the comments. Please go to the personal center to upload the avatar again.

WeChat applet encapsulates request request

 WeChat applet encapsulates request request
Recently, I was working on a small program project and wanted to encapsulate a request for an interface address that is easy to manage. Baidu has found for a long time that the wheels provided by many predecessors are not suitable for me. So I made this wheel myself. I just need to declare the request method and address in the file. It will be very convenient to manage the interface and use it later. 1. Create the api.js file to encapsulate the wx.request request //Import apiList from './apiList'//Use the import index .. Read the full text »

barben Five years ago (April 22, 2020) 3408 Browse 0 Comments two Likes

Understanding the life cycle of WeChat applet in vernacular

 Understanding the life cycle of WeChat applet in vernacular
The life cycle of WeChat applet is divided into application life cycle (App) and page life cycle (Page). 1、 Applet life cycle The life cycle function of the applet application is called in the app.js file. The App() function is used to register an applet and receive an object as a parameter, which specifies the callback of the applet's life cycle. The calling sequence of the applet life cycle: onLaunch (when the applet initialization is completed, and the global trigger is only once)>onShow (applet startup) .. Read the full text »

barben Five years ago (April 14, 2020) 2188 Browse 0 Comments two Likes

ES6 Use Set to Realize Array De duplication

 ES6 Use Set to Realize Array De duplication
Subsequently, in the article Understanding the Set Structure in ES6, we said that the new Set structure in ES6 is similar to an array, but there is no duplicate value. So we can use this feature to implement the array de duplication operation. Use the Array.from method First convert the array to Set type to remove duplicate values, and then use Array. from to convert it back to an array. var arr = [1, 4, 3, 3, 2, 2, 3]; var newAr ... Read the full text »

barben Five years ago (April 3, 2020) 3622 Browse 0 Comments four Likes

ES6 array extension: realize union, intersection and subtraction

 ES6 array extension: realize union, intersection and subtraction
Then, at the end of the last article Understanding the Set Structure in ES6, when I summarized the knowledge points, I saw a method to use the relevant knowledge in [Extension of ES6 Array] to achieve "finding the union, intersection and difference sets of two sets". It is very simple. The implementation method is as follows: let a = new Set([1, 2, 3]); let b = new Set([4, 3, 2]); //Union let union = ne ... Read the full text »

barben Five years ago (2020-04-02) 3480 Browse 0 Comments three Likes

Understand the Set structure in ES6

 Understand the Set structure in ES6
What is a Set? ES6 adds a new data structure called Set. It is similar to an array, but it does not duplicate values. What can be the parameters of new Set()? 1. Array 2. Objects similar to arrays For example, the NodeList collection returned by the DOM operation and the arguments object inside the function. //NodeList object document.querySelectorAll('p'); // argu ... Read the full text »

barben Five years ago (2020-04-02) 3378 Browse 0 Comments three Likes

Will vue jump out of the site when returning to the previous page? How can I jump to the home page without the previous page?

 Will vue jump out of the site when returning to the previous page? How can I jump to the home page without the previous page?
Today, when making the back button on the upper left corner of the mobile phone, a desperate operation was unlocked: If I enter the address directly in other pages to visit my project, and click Back in the project, I will jump back to that page directly. What's the difference between this and the browser's fallback function!!! Don't all mobile websites jump back to the home page if there is no previous page??? //This happens with the go and back methods of vue router this.$router.go(-1); this ... Read the full text »

barben Five years ago (2020-03-13) 4871 Browse 1 Comments six Likes

Adaptive adaptation of vue mobile terminal

 Adaptive adaptation of vue mobile terminal
This is the first article in the Year of the Rat! It is also the first task to complete the development of the WeChat public account mobile terminal project after the forced holiday when we just started working remotely! Without much talk, vue goes! 1、 Installing the lib flexible plug-in [lib flexible] Mobile terminal elastic layout adaptation solution. Used to set the benchmark value of rem. The plug-in will automatically set the font size of the html root element, which is set to one tenth of the screen width by default. For example, if the current .. Read the full text »

barben Five years ago (March 12, 2020) 3878 Browse 0 Comments eight Likes