Skip to content

Commit 51644f0

Browse files
committed
update
1 parent dab6c69 commit 51644f0

File tree

2 files changed

+70
-1
lines changed

2 files changed

+70
-1
lines changed

Example/webpack/index.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width,initial-scale=1">
6+
<title></title>
7+
</head>
8+
<body>
9+
<div>test</div>
10+
<div id="root"></div>
11+
</body>
12+
</html>

README.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@
3535
* [05-03](https://github.com/TYRMars/JSlearn#05-03) `存储`
3636
#### 06
3737
* [06-01](https://github.com/TYRMars/JSlearn#06-01) `模块化`
38+
* [06-02](https://github.com/TYRMars/JSlearn#06-02) `模块化-AMD`
39+
* [06-03](https://github.com/TYRMars/JSlearn#06-03) `模块化-CommonJS`
40+
#### 07
41+
* [07-01](https://github.com/TYRMars/JSlearn#07-01) `上线回滚-上线回滚流程`
42+
3843

3944
---
4045

@@ -1454,7 +1459,8 @@ console.log(aGetFormatDate(dt));
14541459
//直接‘<script src="a.js"></script>’,其他的根据依赖关系自动引用
14551460
//那两个函数,没必要做成全局变量,不会带来污染和覆盖
14561461
```
1457-
#### AMD
1462+
## 06-02
1463+
### AMD
14581464
* require.js `requirejs.org/`
14591465
* 全局define函数
14601466
* 全局require函数
@@ -1514,6 +1520,57 @@ require('[./a.js]',function (a) {
15141520
</body>
15151521
</html>
15161522
```
1523+
1524+
## 06-03
1525+
### CommonJS
1526+
* nodejs模块化规范,现在被大量用于前端,原因:
1527+
* 前端开发依赖的插件和库,都可以从npm中获取
1528+
* 构建工具的高度自动化,是的使用npm的成本非常低
1529+
* CommonJS不会异步加载JS,而是同步一次性加载出来
1530+
1531+
```JavaScript
1532+
module.exports = {
1533+
getFormatDate:function (data,type) {
1534+
if (type === 1) {
1535+
return '2017-06-15';
1536+
}
1537+
if (type === 2) {
1538+
return '2017年6月15日';
1539+
}
1540+
}
1541+
}
1542+
1543+
// a-util.js
1544+
var util = require('util.js')
1545+
module.exports = {
1546+
aGetFormatDate:function (data) {
1547+
return util.getFormatDate(data,2);
1548+
}
1549+
}
1550+
```
1551+
1552+
#### AMD和CommonJS的使用场景
1553+
* 需要异步加载JS,使用AMD
1554+
* 使用了npm之后建议使用CommonJS
1555+
1556+
## 07-01
1557+
### 上线回滚-上线回滚流程
1558+
* 上线和回滚的基本流程
1559+
* linux基本命令
1560+
#### 上线回滚流程
1561+
* 重要的开发环节
1562+
#### 上线流程要点
1563+
* 将测试完的代码提交到git版本库的master分支
1564+
* 将当前服务器的代码全部打包并记录版本号,备份
1565+
* 将master分支的代码提交覆盖到线上服务器,生成新的版本号
1566+
#### 回滚流程要点
1567+
* 将当前服务器的代码打包并记录版本号,备份
1568+
* 将备份的上一个版本号解压,覆盖到线上服务器,并生成新的版本号
1569+
#### Linux基本命令
1570+
* 服务器使用Linux居多,server版,只有命令行
1571+
* 测试环境要匹配线上环境,因此也是Linux
1572+
* 经常需要登陆测试机来自己配置、获取数据
1573+
15171574
---
15181575

15191576
### JSDemo JS小程序

0 commit comments

Comments
 (0)