Disclaimer: As long as these can be mastered, can answer 70%-80% of the interviewer’s technical questions, project interview questions, next update

HTML + CSS

1. Common practical skills

01. Positioning:

Position:absolute/relative/fixed/static

Static: Static positioning.

Absolute: Absolute location. An Absolute location element is located relative to the nearest location ancestor element. However, if an absolutely located element has no located ancestor, it will be located relative to the body of the document

1. Relative, Relative to one’s initial position

Fixed: A Fixed element is positioned relative to the viewport, which means that it is always in the same position even if the page is scrolling.

02. Box Model:

Margin:

Border: Border;

Padding: inside margin;

Content: Content;

Width of box model: left margin + left border + left inner margin +width+ right inner margin + right border + right margin;

Height of box model: upper margin + upper border + upper inner margin +height+ lower inner margin + lower border + lower margin;

03. Vertical water center (the vertical water center of the content and the vertical horizontal center of the box)

(1) Vertical water content in the center:

height=line-height;

Text-align:center;

(2) There are two ways to center the box vertically and horizontally:

Method 1:

Position:absolute;

Left: 50%;

Top: 50%;

Margin-left: – Box width half;

Margin-top:- box height normal;

Method 2:

Position:absolute;

Left: 50%;

Top: 50%;

Transform:translate(-50%,-50%);

2. Knowledge points

01. What are the new HTML5 features

Added semantic labels such as header and footer

Added the video and Audio TAB

New Canvas and SVG drawing

New navigator. Geolocation

A new drag and drop API segmentfault.com/a/119000000…

New multi-threaded technology Web worker and instant messaging technology Web socket

What are the new features of CSS3

Added transition gradient, Animation, selector, Box-shadow, Elastic layout Flex, media query @media, etc

03. What are W3C standards

W3C standards are not a standard, but a collection of standards;

Standards are divided into three levels, structure (HTML), behavior (JS), and presentation (CSS)

Standards are:

Document Type Required Declaration (DOCTYPE)

Encoding format needs to be declared

Javascript code needs to be defined

CSS code needs to be defined

The name of the tag and the name of the attribute inside the tag are lowercase

04. What are the common browser compatibility problems

In different browsers

*{margin:0; padding:0},

Font size:0 for the parent label

05. What are the CSS pseudo-class selectors

: before in… before

: after the… after

Click: active

:hover mouse

The first of all letters

:first-line The first line of the selected element

:first-child The first child element

:nth-child() retrieves child elements

:nth-of-type Gets the child element of the specified type

Dozens of others

06. What are child selectors and what are descendant selectors

Represents a child selector, such as div> SPAN gets the span of a div child

The space represents a descendant selector, such as div SPAN, which gets all spans within a div

07. What is the priority of CSS weights

! Important > Inline style > ID > Class > Tag name

Weights can add up

08. How do browsers make compatible

Internet Explorer usually uses CSS hacks to solve the problem, that is, adding *, _, and + symbols before the code

Google typically prefixes attributes with -webkit- for compatibility

Firefox generally adds -moz- in front of the properties for compatibility

Webpack uses PostCSS to automatically prefix CSS attributes for compatibility

09. How is it adapted at ordinary times

The usual scheme is to match rem with media query (@media).

Instead of setting px for the label or text, I’m going to set REM,

Then use the media query to dynamically adjust the REM size based on the screen size, and all the elements that set the REM unit will change based on the screen

010. What is the difference between REM and EM

Em is defined relative to the font size of the parent label

Rem is defined relative to the font size of the HTML tag

011. What is the difference between Canvas and SVG

Both can be used to draw graphics, but Canvas is drawn based on JS and SVG is drawn based on XML

012. What are the methods of page optimization

(1) Reduce HTTP requests (2) reduce DOM elements (3) strip JavaScript and CSS from pages (4) Remove duplicate scripts (5) use appropriate image formats

13. Semantic understanding?

(1) HTML semantic is to let the content of the page structured, easy to browser, search engine parsing;

(2) It is displayed in a document format without CSS style and is easy to read.

(3) make it easier for people to read the source code to divide the site into blocks, easy to read maintenance understanding.

Second, the JS + jQuery

1. Common practical skills

01. Common functions of arrays and their functions

Juejin. Cn/post / 701582…

2. Knowledge points

01. What are the basic data types of js

Basic types Number, String, Boolean, Null, Undefined, symbol

Reference type Object

What types are returned by typeof in JS

Number, string, Boolean, undefined, symbol, function, object

03. What is the difference between return, break and continue

A return must be written inside the function. If a return is encountered, the rest of the code inside the function is not executed. You can also use return to return a value for external use

Break breaks the loop and the rest of the loop is not executed

Continue Jumps out of the loop, and the rest of the loop continues

04. What is the difference between typeof and instance of

Typeof determines the typeof the object, and there are seven possible return values

Number, string, Boolean, undefined, symbol, function, object

Instanceof checks if it is an instantiated object of the other party and returns true or false

Typeof, instanceof, toString.call(), constructor

05. What is the difference between == (loose equality) and === (strict equality)

== Determine whether the values on the left and right sides are the same, but only the value, not the type, that is to say

2 == 2 is true

=== determines both value and type

06. What are cast and implicit conversions of JS

ParseInt parseFloat, Number of the three is coercion

-=, *=, /=, and %= are implicit conversions

07. What is the difference between a GET request and a POST request

A GET request places parameters in the URL, and a POST request places parameters in the request body. Post is theoretically more secure

The LENGTH of a URL cannot exceed 1KB, and the PARAMETERS of a GET request are included in the URL. Therefore, operations such as uploading an image cannot be performed using a GET request

08. What is bubbling and burrowing

When an event (such as click) is triggered by a child tag, the event is passed level by level from the top-level parent tag to that tag, a process called digging

When the child tag is found, the event is passed from the child tag to the parent tag, a process called bubbling

What about event delegate in JS

Using the principle of event bubbling, the event itself is triggered by its parent element instead of executing

010. Call, apply and bind

(1) This can be changed

(2) The first argument after call, bind is the object to which it points, and the second argument is the value passed to the object

(3) The first argument after apply is the object to which it points, and the second argument is the array that contains the value passed to the object.

(4) Call and apply will be called automatically if they change this, while bind needs to be called manually

011. What does jsonP do and how does it work

Purpose: Resolve cross-domain problems

Principle: dynamic create script tag, callback function

012. What is the difference between cookie, sessionStorage and localStorage

(1) can be used to store data

(2) Cookie a data size cannot exceed 4KB, cannot store more than 20, if the expiration time is not set, it will disappear after the browser is closed

(3) sessionStorage is a sessionStorage, the size of a sessionStorage can not exceed 5M, the number of unlimited, shut down the page data disappear

(4) localStorage localStorage, a size of no more than 5M, the number of unlimited, unless actively deleted, data will not disappear

013. The concept of a prototype

Every JavaScript object contains a [proto] internal property that corresponds to its prototype function object. In addition to the prototype property, there is also a prototype property. When a function object is used as a constructor to create an instance, The prototype property value will be used as the prototype of the instance object.

014. What is a prototype chain?

When an object A calls A method, it will first look for the method from itself. If not, it will look for its own prototype to see if there is such A method. If not, it will continue to look for the prototype of object A’s parent class B, and so on, called the prototype chain.

A is not defined; a is not defined;

015. What is a closure

Closures are when one function can access variables in another function’s scope

A closure is created when a function is wrapped around another function, and the inner function is returned outside the function, so that the original scope chain is not released.

What closures do: modularize scopes, store variables, and encapsulate private variables.

Disadvantages: Memory leaks because closures do not release the original scope chain;

How to fix memory leaks: Use immediate execution functions; (By virtue of the execute immediately function rule, destroy immediately after execution, no memory leak)

016. What is the difference between synchronous and asynchronous

Synchronization process: submit the request → wait for the server to process → return after processing

Subsequent operations can be processed only after a request is processed, which is inefficient. (e.g. B/S mode)

Asynchronous process: Request submission → server processing → complete processing

After sending a request, you do not need to wait for subsequent operations.

When a message is returned, the system notifies the process to process it, which improves the execution efficiency. (AJAX technology, for example)

017. What are the new features of ES6 syntax

(1) const let; (2) const let; Declare constants (3) template strings (4) arrow functions (5) Objects and arrays destruct (6) data types Symbol (7) Set and Map sets (8) Promise objects (9) Introduce the class keyword Symbol function stack cannot use the new command, Because Symbol is a primitive data type, not an object. You can take a string as an argument to provide a description of the newly created Symbol that can be displayed on the console or used as a string for easy differentiation. In Es6, this refers to the scope in which the function is called, and in Es5, this refers to the scope in which the function is called

018. What are the differences between var and let

(1) Var can be used to declare the same variable repeatedly, but let cannot. (2) Var has variable promotion, so it can be assigned first and declared later. Let has no variable promotion. It can only be declared and then assigned to

(3) Variables declared by let have block-level scope

019. What are the features of strict mode (strict mode here generally refers to ES6 strict mode)

(1) The variable must be declared before it is promoted. (2) The deleted variable cannot be used in strict mode. (3) In strict mode, the “this” inside the function points to undefind by default (6) In strict mode, functions cannot be declared in block-level scopes

Function stabilization and throttling

Stabilization: The event triggers and executes the event handler after a certain amount of time has elapsed. If the event is triggered again during this time, the timer will be reset.

Throttling: An event is triggered and an event handler is executed after a period of time. That means that no matter how many times you fire, you can only fire once during this period.

021. What are the common Http status codes

1XX: indicates the information status code. 100 Continue Generally, when a POST request is sent, the server returns an acknowledgement message after the HTTP header is sent, and then sends specific parameter information. Success status code 200 OK Normal message returned 201 Created The request was successful and a new resource was Created. 202 Accepted the request but not yet processed. The page for the 301 Moved Permanently Permanently Moved to a new location. 302 Found Temporary redirect. 303 See Other Temporary redirects and always uses GET to request new URIs. The requested page has Not been Modified since the last request. 4XX: Client error 400 Bad Request The server cannot understand the format of the Request. The client should not attempt to use the same content to initiate a Request again. 401 Unauthorized The request is not authorized. 403 Forbidden Forbidden access. | 404 Not Found I couldn’t find how to match the URI of the resource. 5XX: Server Error 500 Internal Server Error Indicates a common Server Error. 503 Service Unavailable The server cannot process the request temporarily (possibly due to overload or maintenance).

Third, the Vue

1. Knowledge points

01. Common Vue instructions and their functions

V-text: binding text, cannot load labels

V-html: Binding text that can load tags

V-bind: Used to bind data and element attributes

V-if: indicates the condition. If it is true, elements are added and if it is false, elements are deleted

V – for: circulation

V-model: bidirectional data binding

V-show: indicates the conditional judgment. If the value is true, the value is not displayed

02. What happens when V-if and V-for are written in the same label

V-for has a higher priority than V-IF, which has no effect

03. What is the function of the template tag

Wrapping elements together does not itself load into the DOM structure

04. Why must data be a function

Ensure that each component has a single data object to itself, rather than sharing one

05. The Transition label

Set the transition effect, in which only one element can be placed, and must be used with v-if, V-show (or dynamic component, component root node)

If you want to set multiple element gradients, use transition-group

06. What does a slot do? What is a named slot

A slot with a Name value is a named slot

07. What benefits does v-text have over {{}}

{{}} page does not appear {{}}

08. What is the difference between computed and watch

Computed: Computed properties are used to compute results and return cached data when the data changes and recalculated when the data does not change

Watch: monitors the change of a value and performs related operations when the value changes

09. Key function of Vue loop

The existence of the Key ensures the uniqueness. When Vue executes, it will check the node. If there is no Key value, Vue will check the DOM node and empty the content and assign a new value. Transpose or delete operations can reduce the number of renders and improve rendering performance

010. What are the characteristics of axios data requests

1. Create XMLHttpRequests from the browser. Node.js creates the HTTP request. 3. Support Promise API; 4. Intercept requests and responses; 5. Convert request data and response data; 6. Cancel the request. 7. Automatically change to JSON.

012. What is the core of Vue

Data-driven: ViewModel to ensure consistency between data and view.

Component systems: The application UI can be thought of as being entirely composed of component trees.

013. What is the function of keep-alive

Keep components alive and do not remove them even when they are gone

Can be used on the home page, shopping cart, and product details to keep components alive;

014. What is MVVM

M Model Data model, which is the data displayed on the page

V view is the current page

The VM viewModel, which listens for changes in data, the content of the user interaction, is essentially a view Controller, a Controller

015. What are the Vue lifecycle hook functions?

BeforeCreate component before creation

Created after the component is Created

BeforeMount components before rendering

Mounted component after rendering

BeforeUpdate Before a component is updated

Updated After the component is Updated

BeforeDestroy Before a component is destroyed

After the Destroyed component is Destroyed

Activated component (used with keep-Alive)

Deactivated Component is not activated (used with keep-alive)

ErrorCaptured Is called when descendant components fail

016. How does Vue implement bidirectional data binding? What is the principle of bidirectional data binding

Use v-Model for bidirectional binding

Principle: Data hijacking, combined with the publiser-subscriber pattern, is used to hijack the setter/getter of each attribute through Object.defineProperty (). When data changes, a message is published to the subscriber and corresponding listener callback is triggered.

When passing an ordinary JS Object to a Vue instance as its data option, Vue iterates through its properties, turning them into setters/getters with Object.defineProperty ().

Setters/getters are invisible to the user, but internally they let Vue track dependencies and notify properties of changes when they are accessed and modified.

017. There are several ways to transfer data between Vue components. How to transfer data

Parent to Child: The child component accepts it in props mode

Child to parent: The child emits an event $emit, and the parent receives the event and calls the corresponding function

Non-parent: use an empty Vue object to emit $emit in the first component click event and $on in the second component Mounted function to receive the event

018. What are the three types of routing values?

This.$route.params: $route.params: $route.params: $route.params: $route.params: Variable name, Route: meat special; The router: rou (1), (2) using the path to match the routing, and then through the query to pass parameters, to get the value to this. $route. Qurey. $route.params = this.$route.params = this. The variable name

019. What are the event modifiers in Vue?

1.

.once means that the click event is called only once 2.
020. What is the difference between the Hash mode and the history mode in routing?

Hash: the url will be followed by a Hash (#). History: the url will not be followed by a Hash (#). The Hash will result in a page request

What are the hook functions of vue-router

(1) Global guard

BeforeEach Global front guard beforeResolve Global resolution guard afterEach Global rear guardCopy the code

(2) Exclusive guard

beforeEnter
Copy the code

(3) Internal guard of components

BeforeRouteEnter Component front guard (the guard does not have this) beforeRouteUpdate The route changes but the component is reused beforeRouteLeave component rear guardCopy the code

022. What is the role of state management in Vue, and what is the role of properties

Vuex state management is designed to unify the data needed for the page and to be able to use this data anywhere throughout the project. It has five attributes

State: stores initial data

Mutations: a simultaneous method that changes the value of state

Actions: an asynchronous method that calls the Mutations method to change the State value

Getters: Calculates properties, similar to computed properties in components

Modules: Used to manage other Vuex objects

Generally used to store the user login token (token represents the user login status, not worth the user ID); The user id

Bug: Data is lost in state when the page is refreshed

General solutions:

(1) App. vue created method reads the data in sessionStorage and stores it in store. At this time, vuex.store replaceState method is used to replace the store root state

(2) Store. State to sessionStorage in the beforeUnload method.

023. What are dynamic components?

What component is based on the value of the is property

024. What are asynchronous components?

A component that is not loaded immediately when a route is loaded and is not loaded until it is needed is called an asynchronous component

025. System modifiers

.ctrl、.alt、.shift、.meta

026. Key modifier

Enter, TAB, delete, ESC, space, Up, Down, left, right

027. How to solve cross-domain problems in Vue project?

Set the proxyTable attribute in config/index.js. If the scaffold version is 3.0 or later, you need to create a vue.config.js file to configure the cross-domain solution: juejin.cn/post/703322…

028. How to package APP for Vue project

1. Use the command NPM run build to create a dist folder

2. Create a 5+ APP project using HBuilder and select the default template

3. Replace the contents of the hBuilder project with the contents of the Dist folder

4. Choose native App-cloud packaging

029. How to solve the packing blank problem

1. Add the value of publicPath in vue.config.js from absolute path to relative path, / to

2. If the static resource is in the specified file, specify the output path outputDir: “dist”

3. Delete the historical mode of the route

030. What are the differences between the Vant, Element and meiziUi component libraries

Vant: Mainly engaged in mobile terminal mall projects

Element: Mainly do PC side web pages

Amaze: Mainly mobile

031. What does a vue bucket do

Vue-router Route management Creates and configures routes

Vuex Status Management Data required for unified management can be used globally

Vue-cli is used to set up Vue projects

Axios is used for data requests

032. How does Vue optimize the first screen loading speed?

(1) Load components as required, not all components at one time

(2) Reduce unnecessary network requests;

033. Distinction between devDependencies and Dependencies

(1) devDependencies

For local development, these dependencies are not packaged in the production environment when packaged

(2) the dependencies

The development environment works, the production environment works. The production environment will be packaged

Fourth, the Webpack

1. Knowledge points

01. What are the modular classifications

A. Modularity of the browser

(1) AMD(Asynchronous Module Definition) represents the product: require.js

(2) CMD(Common Module Definition) represents the product: sea-.js

B. Server side modularization, server side modularization specification is using CommonJS specification:

1. Introduce other modules or packages using require

2. Exports module members using exports or module.exports

3. A file is a module, each with its own scope

C. ES6 modularization, as defined in the ES6 modularization specification:

1. Each JS file is an independent module

2. Import module members using the import keyword

3. Expose module members using the export keyword

Summary: ES6 modularity is recommended because AMD, CMD is limited to browser side,

CommonJS is used on the server side,

ES6 modularity is a common specification on both the browser and server side.

02. What is the difference between export default and exports

The former is the default export, each module can only have one, import XX from ‘XXX’ when the way

The latter is an export, each module can have more than one, import the need to use {XX} from ‘XX’ way

If no member is exposed in a module, other modules importing the module will get an empty object

03. What does Webpack do?

Webpack is a popular front-end project building tool that provides modularity support, code compression obfuscating, compatibility resolution, performance optimization and other features that improve development efficiency and project maintainability.

1. Reload the translation of the code.

2. Merge static resources to reduce I/OS

04. What is the installation command for Webpack?

npm install webpack webpack-cli -D

05. What is the difference between development and production in Webpack

The former is development mode, code is not compressed, and packaging is faster

The latter is production mode, where the code is compressed and packaged relatively slowly

06. How to configure the exit and entrance of Webpack

Set the entry field in webpack.config.js, which is used as the entry to the configuration file. The default is index.js under SRC

Set the output field in webpack.config.js, which is used to configure the exit of the file. The default is main.js in the dist file

07. How to configure webpack automatic packaging

A. Install the package webpack-dev-server for automatic packaging

       npm install webpack-dev-server -D

B. Modify the dev command in package.json as follows:

"scripts":{
           "dev":"webpack-dev-server"
          }
Copy the code

(absolute path)

D. Run NPM run dev to package the package

08. Difference between Webpack Loder and plugins

Loader is a file loader that loads resource files and performs some processing, such as compilation and compression, on these files

Plugins are primarily extensions of webpack functionality

09. How does Webpack pack non-JS files

Download the file’s loader and configure the syntax for the Module in webpack.config.js

010. How does WebPack pack CSS files

Download style-loader and CSS-loader and configure the syntax rules in webpack.config.js

011. How does WebPack pack less files

Download less, less-loader, CSS-loader, and style-loader, and configure the syntax rules

012. How does WebPack pack image files

Download url-loader and file-loader and configure syntax rules

013. Webpack packs non-VUE

①. NPM init initial project

②. Install Webpack and web-CLI

(3) Configure entry/output

④ Set automatic packaging

⑤. Download the module loader and configure the syntax rules in webpack.config.js

Five, wechat small program

01. How to get user information in wechat mini program

Wx.getuserinfo is now updated to wx.getUserProfile

02. How does wechat applet achieve user login

wx.login

03. How to obtain the current mobile device information, such as brand, operating system, bluetooth information, etc., in wechat mini program

wx.getSystemInfo

04. How to update wechat mini program

wx.updateWeChatApp

5. What are the ways to jump to the page of wechat mini program

Wx. switchTab can jump to only a few pages contained in tabbar

NavigateTo jump to other pages not included in tabbar

Wx. navigateBack closes the current page and returns to the previous level

Wx. redirectTo redirects to close the current page and cannot jump to pages contained in tabbar

Wx. reLaunch closes all pages and opens to a page within the app

06 wechat if the implementation of pull-down refresh

1. At json or app page. Configuration of json enablePullDownRefresh: true then, in the middle of the need to monitor the page refresh of js onPullDownRefresh automatically trigger function

2. Refresh can be enabled and disabled through wechat API– wx.startPulldownRefresh and wx.stopPulldownRefresh

07. How do I scroll to a specified location

wx.pageScrollTo

08. How does wechat request, download and upload data

Data request: wx.request

Upload: wx. UploadFile

Download: wx. DownloadFile

09. How does wechat applet share data in the page

1. Store data in globalData in app.js

2. Use wx.setStorage to store the file locally

010. How does wechat mini program get its own location information

Wx. getLocation can obtain the current geographical location, speed and other information

011. What are the life cycle functions of wechat applets

1. OnLoad () is triggered when the page loads and is called only once

2. OnShow () page display/back to the foreground call multiple times

3. OnReady () is called once after the first rendering of the page

4. OnHide () is called when the page is hidden/in the background

5. OnUnload () is triggered when the page unloads

012. How does wechat applets prevent events from bubbling

You can use catchTap instead of bindTap

The bind event binding does not prevent bubbling events, and the Catch event binding components prevent bubbling events

013. Tell me your understanding of RPX

Divide the current screen into 750rpx, regardless of the actual pixels

014. What are the advantages and disadvantages of wechat applets

Advantage:

1. Easy to use, with rich components and powerful APIS

2. Extensive user base

3. No download required

4. Lower development cost than APP

Disadvantage:

1. The size of a single page cannot exceed 1 MB, and pages of more than five levels cannot be opened

2. Components have a single style. If the components cannot meet requirements, you need to customize them

3. Depending on wechat, a separate installation package cannot be packed

015. What is the difference between wechat mini program and H5

1. Different operating environments. Wechat applet runs in wechat, while H5 runs in browser

2. The development cost is different, so H5 needs to be compatible with various browsers

3. It is very simple for small programs to obtain the permissions of the mobile phone system, while H5 is more complicated and needs to rely on other things, such as uniApp or plug-ins

4. Event binding, value transmission and data request methods are different

Sixth, the Git

01. How do you work in a team

1. First of all, the requirements will be determined. The UI designer will design the effect map according to the requirements

2. The server interface is given by the back end, which will give a developer document, which has information such as address, request type, parameters and return value of each request interface

3. Each member of the front-end group will use Git for code submission. They will pull the latest code at work every day and push the code at the end of work

02. How to resolve code conflicts

1. Commit your code to the local repository first

2. Then pull the latest code from the cloud vault

3. Merge code and resolve conflicts manually (remove excess code or merge two pieces of code) if any conflict occurs during the merge.

4. After resolving the conflict, re-submit it to the local computer and finally upload it to the cloud warehouse

03. What version of Git tools do you use

Use the command line for submission

Tools used sourceTree, as well as Git’s own submission tool

04. What is the difference between Git and SVN

1. Usually only git is used

2. Git is distributed while SVN is centralized

3. The Git repository can be cloned locally, and the SVN can only be stored in the cloud

4. Git supports offline submission, whereas SVN can only submit online

05. Git commands are commonly used

Git status Check the code status

Git add. save the code to the staging area

Git commit -m save the code to the persistence zone

4. Git pull pulls down the cloud repository code

Git push uploads code to the cloud

6. Git Clone clone the cloud repository code locally

Git merge XX allows you to merge branches only on the main branch