当前位置:网站首页>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
边栏推荐
猜你喜欢

Data communication foundation TCPIP reference model

抓包工具fiddler和wireshark对比

Study on the basis of opencv

Learning about opencv (2)

【Halcon视觉】编程逻辑
![[Qualcomm][Network] qti服务分析](/img/76/49054ff8c7215eca98cc479ab1d986.png)
[Qualcomm][Network] qti服务分析

Some cutting-edge research work sharing of SAP ABAP NetWeaver containerization

议程速递 | 7月27日分论坛议程一览

2022/07/25 ------ arrangement of strings

js翻页、kkpager.js翻页
随机推荐
Wechat official account release reminder (wechat official account template message interface)
Replay the snake game with C language (II) end
【Halcon视觉】极坐标变换
Structure of [Halcon vision] operator
videojs转canvas暂停、播放、切换视频
2022/07/25------字符串的排列
移动端双指缩放事件(原生),e.originalEvent.touches
【Halcon视觉】软件编程思路
3.1 leetcode daily question 6
Google与Pixar开发Draco支持USD格式 加速3D对象传输&lt;转发&gt;
What will the new Fuzhou Xiamen railway bring to Fujian coastal areas?
Redis realizes the correct posture of token bucket
[Qualcomm][Network] qti服务分析
Listening freely, the next stop of online text traffic competition?
IEEE conference upload font problem
Solution of inputting whole line string after inputting integer
Network related journals and conferences in CS
【Halcon视觉】图像的傅里叶变换
Agenda express | list of sub forum agenda on July 27
畅听,网文流量竞争的下一站?