须知内容
分支备份: git checkout master -b xxxxx
样式文件 bootcdn 稳定、快速、免费的前端开源项目 CDN 加速服务网址:https://www.bootcdn.cn/
模板引擎所有koa-views
: https://github.com/tj/consolidate.js#supported-template-engines
安装koa-views:npm install koa-views -S
模板引擎1 ejs 官网:https://github.com/tj/ejs
安装 ejs npm install ejs -S
模板引擎2 pug 官网: https://github.com/pugjs/pug
安装 pug npm install pug -S
可以任选一个,ejs模板可以替换字符串变量<%
表示 , pug
可以简写html
变更简单
视频插件:http://dplayer.js.org/#/zh-Hans/
安装:npm install dplayer --save
使用 Yarn: yarn add dplayer
1、创建一个film
文件, CD
进入这个文件
2、运行 npm init
初始化文件
3、安装最新版 koa:npm install koa@latest -S --registry=https://registry.npm.taobao.org
cnpm
和npm
安装方式不一样容易出现bug
再package.json
设置快捷启动
{"scripts": {
"start":"node server/index.js", //由于路径是再server/index.js里面的所以启动设置快捷方式start。
"test": "echo \"Error: no test specified\" && exit 1"
},}
启动服务 npm start
这里console.log();
报错:
Uncaught TypeError: Cannot read property ‘fn’ of undefined at util.js:56 at
更改引入顺序就可以解决jquary要再bootstrap前面
Promise 用法
const promist = new Promise(function(resolve,reject){
if(/*异步操作成功*/){
resolve(value);
}else{
reject(error);
}
})