当前位置:网站首页>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
边栏推荐
- Employee information management system based on Web
- [Halcon vision] image gray change
- 2022/07/25------字符串的排列
- [Halcon vision] polar coordinate transformation
- 将json文件中数组转换为struct
- 码云,正式支持 Pages 功能,可以部署静态页面
- Agenda express | list of sub forum agenda on July 27
- 【Halcon视觉】形态学膨胀
- Data communication foundation telnet remote management equipment
- Dynamically determine file types through links
猜你喜欢
![[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

Li Kou daily question 917
![[Halcon vision] threshold segmentation](/img/1c/e2463a796f99804a55680b69e714a6.png)
[Halcon vision] threshold segmentation

The difference between equals and = =

Study on the basis of opencv

Learning about opencv (3)
![[Halcon vision] image filtering](/img/7a/b95f8977f02fab644ef9fb205424e7.png)
[Halcon vision] image filtering

2022/07/25 ------ arrangement of strings
![[Halcon vision] affine transformation](/img/f1/32284c71e78e6eea390fdb6058ba0f.png)
[Halcon vision] affine transformation

Data communication foundation - layer 2 switching principle
随机推荐
原生JS-获取transform值 x y z及rotate旋转角度
[Halcon vision] software programming ideas
js翻页、kkpager.js翻页
移动端H5开发常用技巧总结
Closure of go (cumulative sum)
我们的Web3创业项目,黄了
3.1 leetcode daily question 6
简单化构造函数的继承方法(二)- ES6中的class继承
软件打不开了
【Halcon视觉】图像的傅里叶变换
PLC概述
IEEE conference upload font problem
[award-winning question] ask Judea pearl, the Turing prize winner and the father of Bayesian networks
PTA class a 1001
Self encapsulated database dbutils universal template
PLC overview
SQL Server 2008 R2 installation problems
Cause: couldn‘t make a guess for 解决方法
AirTest
【Halcon视觉】形态学膨胀