└─public
├─images
├─js //自己写代码的地方
├─lib //第三方包存放的地方
│ ├─jquery
│ ├─jquery-base64 (https://github.com/carlo/jquery-base64)
│ ├─jquery-cookie (https://github.com/huya-fed/jquery-cookie)
│ ├─jquery-dateFormat (https://github.com/phstc/jquery-dateFormat)
│ ├─jquery-MD5 (https://github.com/placemarker/jQuery-MD5)
│ ├─layer (http://layer.layui.com/)
│ ├─layerMobile (http://layer.layui.com/mobile/)
│ ├─lazyload (https://github.com/jieyou/lazyload)图片懒加载的
│ ├─require-css (用于加载css的require插件)
│ ├─requirejs
│ ├─swiper
│ └─xarch
└─styles //自己写css的地方
** 1.必需要读: **
** 2.选择阅读: **
** 1. 使用AMD规范组织代码 **
define(['myLib'], function(myLib){
function foo(){
myLib.doSomething();
}
return {
foo : foo
};
});
** 2. 代表jQuery对象的变量前面可以加个$,这样一眼就能看出来是个jQuery对象。 **
var $dom = $("#dom");
** 3.函数参数大于3个的时候,应该使用对象封装起来(避免修改参数而导致函数参数乱序) **
var myfn = function(opts){
opts && console.info(opts.a);//输出a参数
opts && console.info(opts.b);//输出b参数
opts && console.info(opts.c);//输出c参数
}
** 4. JS里声明变量必须加上 var 关键字 **
** 5. JS代码结尾统一约定加';' **
** 6. JSON对象的最后一个字段、数组最后一个元素后面都不能加',',在IE8下会报错:所以{a:1,b:2,}/[1,2,] 都是不对的. **
** 7. JS模块里面私有的方法前面可以加_,公有方法不加,但是函数内的局部变量就没必要加_了; **