-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
168 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
## 进制转换 | ||
|
||
二进制转十进制,十进制转二进制 | ||
|
||
parseInt | ||
``` | ||
["1", "2", "3"].map(parseInt); | ||
答案:[1, NaN, NaN] | ||
解析:parseInt (val, radix) :两个参数,val值,radix基数(就是多少进制转换) | ||
map 能传进回调函数 3参数 (element, index, array) | ||
parseInt('1', 0); //0代表10进制 | ||
parseInt('2', 1); //没有1进制,不合法 | ||
parseInt('3', 2); //2进制根本不会有3 | ||
巩固:["1", "1", "11","5"].map(parseInt) //[1, NaN, 3, NaN] | ||
parseInt('13',2) // 1 , | ||
计算机在二进制只认识0,1,parseInt转换时就当作不认识的字符忽略了 | ||
parseInt('18str') //18 10进制能认识到9 | ||
parseInt(1/0,19) // 18 | ||
1/0 == Infinity 19 进制计算机能认识最后一个字符是i | ||
详细解析在下面的链接 | ||
``` | ||
|
||
|
||
|
||
js 对象分类(https://time.geekbang.org/column/article/80011) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width,initial-scale=1.0"> | ||
<title>Title</title> | ||
</head> | ||
<body> | ||
|
||
<script> | ||
class A { | ||
methodA () { | ||
this.properyA = 'a' | ||
return 'methodA' | ||
} | ||
} | ||
|
||
class B extends A { | ||
constructor () { | ||
super(); | ||
} | ||
methodB () { | ||
return 'methodB' | ||
} | ||
} | ||
|
||
let b = new B() | ||
</script> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
## 1. vue:将px转化为rem,适配移动端vant-UI等框架(postcss-pxtorem) | ||
|
||
(1)下载lib-flexible: | ||
``` | ||
yarn add lib-flexible | ||
``` | ||
|
||
(2)引入 lib-flexible: | ||
在main.js中引入lib-flexible | ||
``` | ||
import 'lib-flexible/flexible' | ||
``` | ||
|
||
(3).设置meta标签 | ||
``` | ||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no"> | ||
``` | ||
|
||
(4).安装postcss-pxtorem | ||
``` | ||
yarn add postcss-pxtorem | ||
``` | ||
|
||
(5) 配置 postcss-pxtorem | ||
browsers 改为 overrideBrowserslist | ||
``` | ||
module.exports = { | ||
plugins: { | ||
//... | ||
'autoprefixer': { | ||
// vant 官方的配置有问题 | ||
// browsers: ['Android >= 4.0', 'iOS >= 7'] // 修改前 | ||
overrideBrowserslist: ['Android >= 4.0', 'iOS >= 7'] // 修改后 | ||
}, | ||
'postcss-pxtorem': { | ||
rootValue: 37.5, // vant-UI的官方根字体大小是37.5 | ||
propList: ['*'] | ||
} | ||
} | ||
} | ||
``` | ||
|
||
可能 postcss-pxtorem 出现问题, 以上的解决方案: | ||
``` | ||
Replace Autoprefixer browsers option to Browserslist config. | ||
Use browserslist key in package.json or .browserslistrc file. | ||
Using browsers option can cause errors. Browserslist config | ||
can be used for Babel, Autoprefixer, postcss-normalize and other tools. | ||
If you really need to use option, rename it to overrideBrowserslist. | ||
Learn more at: | ||
https://github.com/browserslist/browserslist#readme | ||
https://twitter.com/browserslist | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters