当前位置:网站首页>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
边栏推荐
- 单元测试,到底什么是单元测试,为什么单测这么难写
- Review of database -- 1. Overview
- SPARK中 DS V2 push down(下推)的一些说明
- 面试第一家公司的面试题及答案(一)
- Okaleido ecological core equity Oka, all in fusion mining mode
- mysql 进不去了怎么办
- PTA class a 1001
- Draco developed by Google and Pixar supports USD format to accelerate 3D object transmission & lt; Forward & gt;
- All codes of Tetris
- Cause: couldn‘t make a guess for 解决方法
猜你喜欢
[Halcon vision] image filtering
2022/07/25------字符串的排列
Okaleido ecological core equity Oka, all in fusion mining mode
[qualcomm][network] QTI service analysis
Tradingview 使用教程
equals与==的区别
【Halcon视觉】图像的傅里叶变换
[Halcon vision] software programming ideas
[Qualcomm][Network] qti服务分析
Introduction to latex, EPS picture bounding box
随机推荐
新建福厦铁路全线贯通 这将给福建沿海带来什么?
Prevent XSS attacks
SQL Server 2008 R2 installation problems
Network related journals and conferences in CS
Map key not configured and uniapp routing configuration and jump are reported by the uniapp < map >< /map > component
All codes of Tetris
Google与Pixar开发Draco支持USD格式 加速3D对象传输&lt;转发&gt;
What will the new Fuzhou Xiamen railway bring to Fujian coastal areas?
Modelsim installation tutorial (application not installed)
Function templates and non template functions with the same name cannot be overloaded (definition of overloads)
Kaptcha image verification code integration
句句解析js中的完美 / 缓冲运动框架(新手专用)
如何写一篇百万阅读量的文章
[award-winning question] ask Judea pearl, the Turing prize winner and the father of Bayesian networks
Structure of [Halcon vision] operator
The CLOB field cannot be converted when querying Damon database
Data communication foundation TCPIP reference model
畅听,网文流量竞争的下一站?
The problem of incomplete or partial display of the last recyclerview is solved
【Halcon视觉】图像滤波