**1.有的淘宝镜像用的不了、、 请用这个
npm install -g cnpm --registry=https://registry.npm.taobao.org**
**2.可以当作隐式转换的东西,只用记住true其他都是false**
Boolean(undefined) //false
Boolean(null) //false
Boolean(0) //false
Boolean("") //false
Boolean(false) //false
// 有时候写逻辑(比如条件if( el == "" ){})的时候需要
Boolean({}) //true
Boolean([]) //true
Boolean("0") //true
Boolean(1) //true
//
3.箭头函数:
如果只有一个参数,()可以省略
如果只有一个return,{}可以省略
4.yarn create react-app my-app ***相当于***:
----$ yarn global add create-react-app //npm i -g create-react-app
----$ create-react-app my-app // create-react-app my-app
5. 自适应和响应式的区别
自适应是在不同大小的设备上呈现同样的网页(不改变布局)
响应式是在不同大小的设备上呈现不同的网页 (改变布局)
6.rem的实现方案
首先、根据不同屏幕的设备物理像素,要跟html元素的fontSize设置不同的px大小
1、媒体查询 (设置rem)
html{
font-size:16px;
}
@media screen and (min-width:240px) {
html {
font-size:9px;
}
}
@media screen and (min-width:320px) {
html {
font-size:12px;
}
}
@media screen and (min-width:375px) {
html{
font-size:14.0625px;
}
}
利用@media screen and (min-width:XXX)来判断设备的尺寸,进而设置html的fontSize
前端技术知识收录
最新推荐文章于 2024-09-16 08:47:17 发布