当前位置:网站首页>Interview questions and answers of the first company (I)
Interview questions and answers of the first company (I)
2022-07-26 10:27:00 【Xaivor】
1. Talk about the understanding of cross domain , How to deal with cross domain ?
Simple understanding : Browser or JavaScript Say it's for safety , Restrictions on homology strategies .
Treatment method 1 :porxy agent
Through the same domain name web The server creates a proxy , For example, the server background in Hangzhou (www.hangzhou.com/porxy-hangzhouservice.php) To call Guangzhou server (www.guangzhou.com/server.php) Service for , Then return the response result to the front end , thus , The effect of calling Hangzhou's same domain name service at the front end is the same as that of calling Shanghai's service .Treatment method 2 :JSONP( I won't support it POST request )
It is used to solve the problem of cross data access of mainstream browsers .
a.com in
<script>
function jsonp(json){
alert(json["name"]);
}
</script>
<script src="http://a.com/json.js"></script>
b.com in
jsonp({
'name':' Xiao Ming ', 'age':24});
- Treatment method 3 :XHR2
H5 Provided XMLHttpRequestLevel2 Cross domain access and other new functions have been implemented .
IE10 None of the following versions support
Just make some small changes on the server
header(‘Access-Control-Allow-Origin:*’);
header(‘Access-Control-Allow-Methods:POST, GET’);
2. What is the concept of closure ?
- A closure is a function defined inside a function
- Closures are variables that can access functions ( Functions that can read internal variables of other functions )
- Even if the containing function is executed , Variables referenced by closures are not released
Three conditions :
- Access scope
- Nested function
- Called outside the scope
IIFE( Immediate execution function ): Satisfy 1, dissatisfaction 2 and 3.IIFE( Immediate execution function ): Satisfy 1, dissatisfaction 2 and 3.
3.vue The concept of life function in
What is? vue Life cycle ?
answer : Vue The process from creation to destruction of an instance , Life cycle . That is, create from the beginning 、 Initialization data 、 Compiling templates 、 mount Dom→ Rendering 、 to update → Rendering 、 Unloading and so on , We call it Vue Life cycle of .vue What is the role of the life cycle ?
answer : It has multiple event hooks in its life cycle , Let's control the whole Vue It is easier to form good logic in the process of instance .vue There are several stages in the life cycle ?
answer : It can be divided into 8 Stages : Before creation / after , Before loading / after , Before updating / after , Before destruction / After destructionWhich hooks will be triggered in the first page load ?
answer : Triggered the first time a page is loaded beforeCreate, created, beforeMount, mounted These hooksDOM Rendering in Which cycle has been completed ?
answer :DOM Rendering in mounted China has finished .Briefly describe which scenarios are suitable for each cycle ?
answer : Some ways to use life cycle hooks : beforecreate : You can add one here loading event , Triggered when an instance is loaded created : The events at the completion of initialization are written here , If it ends here loading event , Asynchronous requests are also suitable to be called here mounted : Mount element , Get DOM node updated : If the data is processed uniformly , Write the corresponding function here beforeDestroy : You can make a confirmation box to confirm the stop event nextTick : Immediate action after data update dom
4. To draw a triangle css style
Analyze a wave of , There are many kinds of triangles , But they are inseparable from width and height 0, Make sure an edge is colored , Then make other edges transparent transparent, The code is as follows :
#triangle{
/** This is an inverted triangle **/
width:0;
height:0,;
border-top:100px solid red; /** The positive triangle foot is changed to bottom**/
border-right:50px solid transparent; /** If you want a right angle, you only need one side color , One edge is transparent **/
border-left:50px solid transparent;
}
5. The process of page loading
1. Enter the address
2. The browser looks up the domain name IP Address
3. This step includes DNS Specific search process , Include : Browser cache -> System cache -> Router cache …
4. Browser direction web Server sends a HTTP request
5. The server's permanent redirect response ( from http://a.com To http://www.a.com)
6. Browser tracking redirect address
7. Server processing request
8. The server returns a HTTP Respond to
9. Browser display HTML
10. Browser send request get embedded in HTML The resource ( Such as images 、 Audio 、 video 、CSS、JS wait )
11. Browser sends asynchronous request
边栏推荐
- About automatic operation on Web pages
- Dynamically determine file types through links
- Replay the snake game with C language (II) end
- 新建福厦铁路全线贯通 这将给福建沿海带来什么?
- Learning about tensor (III)
- [Halcon vision] threshold segmentation
- 【Halcon视觉】极坐标变换
- Under win10 64 bit, matlab fails to configure notebook
- [Halcon vision] software programming ideas
- PTA class a 1001
猜你喜欢

数据库的复习--1.概述

Basics of data communication - basic knowledge of network

The charm of SQL optimization! From 30248s to 0.001s
![[Halcon vision] threshold segmentation](/img/1c/e2463a796f99804a55680b69e714a6.png)
[Halcon vision] threshold segmentation

Review of database -- 1. Overview

单元测试,到底什么是单元测试,为什么单测这么难写

Deduct daily question 838 of a certain day

【Halcon视觉】算子的结构

【Halcon视觉】数组
![[award-winning question] ask Judea pearl, the Turing prize winner and the father of Bayesian networks](/img/0f/01d6e49fff80a325b667784e40bff3.png)
[award-winning question] ask Judea pearl, the Turing prize winner and the father of Bayesian networks
随机推荐
C language course design Tetris (Part 1)
The problem of four columns of Hanoi Tower
Beginner of flask framework-04-flask blueprint and code separation
码云,正式支持 Pages 功能,可以部署静态页面
Tradingview 使用教程
Comparison of packet capturing tools fiddler and Wireshark
Introduction to latex, EPS picture bounding box
移动端双指缩放事件(原生),e.originalEvent.touches
简单化构造函数的继承方法(二)- ES6中的class继承
Flask framework beginner-03-template
[C language] named type and anonymous type
The CLOB field cannot be converted when querying Damon database
详细解析js中的混合方式构造对象(构造加属性,原型加方法)
Self encapsulated database dbutils universal template
[Halcon vision] image gray change
[Halcon vision] Fourier transform of image
string null转空字符串(空字符串是什么意思)
Deduct daily question 838 of a certain day
句句解析js中的完美 / 缓冲运动框架(新手专用)
The problem of incomplete or partial display of the last recyclerview is solved