添加 Web前端面试题.md
This commit is contained in:
parent
5a79e97e23
commit
2fedd0692f
23
Web前端面试题.md
Normal file
23
Web前端面试题.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## v-if和v-show的区别,分别适合什么场景
|
||||||
|
|
||||||
|
v-if 操作的实际上是 dom 元素的创建或销毁。v-show 操作的是display:none/block属性。频繁地切换使用 v-show,否则使用 v-if。
|
||||||
|
|
||||||
|
## async await 关键字的用途
|
||||||
|
|
||||||
|
async await 是es7里面的新语法,async 用于声明一个异步函数,await 阻塞等待一个异步方法执行完成。
|
||||||
|
|
||||||
|
## Cookie 、LocalStorage 、 SessionStrorage的区别
|
||||||
|
|
||||||
|
- Cookie 是 http 协议的组成部分,会在同源 http 请求中携带,数据根据不同浏览器限制,大小一般不能超过4k
|
||||||
|
- LocalStorage 和 SessionStrorage 仅会持久化存储,大小一般是5M
|
||||||
|
|
||||||
|
## this 的指向有哪些
|
||||||
|
|
||||||
|
1、普通函数中的 this 指向 window
|
||||||
|
2、定时器中的 this 指向 window
|
||||||
|
3、箭头函数没有 this,它的 this 指向取决于外部环境
|
||||||
|
4、事件中的 this 指向事件的调用者 黑马程序员
|
||||||
|
5、构造函数中 this 和原型对象中的 this,都是指向构造函数 new 出来实例对象
|
||||||
|
6、class 中的 this 指向由 constructor 构造器 new 出来的实例对象
|
||||||
|
7、自调用函数中的 this 指向 window
|
||||||
|
|
Loading…
Reference in New Issue
Block a user