├── .idea ├── .name ├── misc.xml ├── modules.xml ├── vcs.xml ├── web-front-end-thinking-tutorial.iml └── workspace.xml ├── README.md └── practice ├── autoComplete.js ├── index.html ├── lxy ├── 1 │ ├── 1.js │ ├── 2.js │ ├── 3.js │ ├── 4.js │ ├── 5.js │ ├── 6.js │ ├── 7.js │ └── 8.js └── 2 │ └── 2-1.html ├── machi ├── 1 │ ├── anwser.js │ ├── index1.html │ └── note_1.md ├── 2 │ ├── autoComplete.js │ └── index.html └── 3 │ └── note.md ├── wuhuizhong ├── 1 │ ├── README.md │ └── index.html ├── 2 │ ├── README.md │ ├── main.html │ └── main.js └── 3 │ ├── React笔记.md │ └── 个人总结.md └── yuwei ├── 1 └── answer.js ├── 2 └── .idea │ ├── .name │ ├── 2.iml │ ├── misc.xml │ ├── modules.xml │ ├── vcs.xml │ └── workspace.xml ├── 3 ├── .babelrc ├── .gitignore ├── .jshintrc ├── index.html ├── package.json ├── src │ ├── component │ │ ├── Root.jsx │ │ ├── Todo.jsx │ │ └── TodoList.jsx │ ├── css │ │ └── style.css │ └── main.js └── webpack.config.js └── 2-autoSuggest ├── index.html ├── index.js └── style.css /.idea/.name: -------------------------------------------------------------------------------- 1 | web-front-end-thinking-tutorial -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/web-front-end-thinking-tutorial.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 40 | 41 | true 42 | 43 | 44 | 45 | 46 | 47 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 83 | 84 | 85 | 86 | 89 | 90 | 93 | 94 | 95 | 96 | 99 | 100 | 103 | 104 | 107 | 108 | 109 | 110 | 113 | 114 | 117 | 118 | 121 | 122 | 125 | 126 | 129 | 130 | 131 | 132 | 135 | 136 | 139 | 140 | 143 | 144 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 1460026157936 165 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # web-front-end-thinking-tutorial 2 | 3 | ## 前言 4 | ### 教学课程 5 | 见仓库 6 | 7 | ### 教学模式 8 | 课程采取线下教课模式;github 上看到的人,线上自学模式 9 | 10 | ### 教学作业和答案 11 | 将在 github 上 提交,标准答案在 ./practice/yuwei/ 路径下 12 | 13 | 14 | ## 总教学提纲 15 | ### 基础 16 | - 编程基础 17 | - 你有多喜欢编程 18 | - 你平均每天在编程上花多少时间 19 | - 除了看书、写代码,你的思考有多少 20 | - chrome dev tool:控制台调试、断点调试、性能检测 21 | - js 语法基础 22 | - string、array 常用方法 23 | - 闭包 24 | - this 25 | - 原型链、继承 26 | - js 事件队列 27 | - 回调函数的原理 28 | - es6 常用语法基础 29 | - 解构、let和const、扩展运算符 30 | - 箭头函数、Promise 对象 31 | - Module(重点) 32 | - dom 基础 33 | - DOM 增删改查 34 | - DOM 事件机制 35 | - css 基础(不讲) 36 | - git 基础(不讲) 37 | - web 性能优化基础 38 | - 看书了解原理:[《高性能网站建设指南》](http://book.douban.com/subject/3132277/) 39 | - 请求数量: 合并脚本和样式表, iconfont,拆分初始化负载,划分主域 40 | - 请求带宽: 开启 GZip,精简 JavaScript,移除重复脚本,图像优化 41 | - 缓存利用: 使用 CDN,使用外部 JavaScript 和 CSS,减少 DNS 查找 42 | - 页面结构: 将样式表(影响样式的内容)放在顶部,将脚本放在底部,尽早刷新文档的输出 43 | 44 | ### 实战 45 | > 1. 都是 纯前端项目、2人一组,通过 fork + PR 来在 github 上面提交 46 | > 2. 所有项目可以使用 boostrap、purecss 这种 css 样式库,自己就可以省掉写 css 的时间快速学习、开发。 47 | > 3. 完成基本功能就 ok,自由发挥为主(选择如何组织项目结构、选择使用的库,自己当自己的架构师) 48 | 49 | 50 | #### 小作业 51 | - 使用 DOM 写简版的搜索栏(功能和百度谷歌类似) 52 | - 模仿前端渲染框架工作原理(比如模仿 react)写个简版 TODO(可以选择使用 jquery) 53 | - 使用 react 写个简版 TODO 54 | 55 | #### 大作业 56 | - 使用 react react-router redux 写一个包括模拟登陆功能的简版 TODO 应用(假设用户不刷新,有能力的人可以使用 localstorage 来完成一个完整的 webapp) 57 | - 或者自己的点子,还是用 react react-router redux 的技术栈 58 | 59 | ### 框架、工具 60 | - 学会查文档 61 | - [MDN](https://developer.mozilla.org/zh-CN/docs/Web) 是 web 开发者学习的好地方,不需要刷,但是需要你想了解语法细节的时候,会查、肯看 62 | - mac 可以使用 dash 阅读 MDN 的文档 63 | - 其他平台可以使用在线文档 (http://devdocs.io/) 64 | - 学习框架类库最好的地方就是直接阅读 github README、看官方文档的 get start、github 仓库的 example、源码 65 | - github 66 | - fork 67 | - PR 68 | - webpack 69 | - 使用 es6 等预处理器 70 | - 开发(dev)环境和生产(production)环境 71 | - react 72 | - 基本概念 73 | - 基本使用 74 | - vitural DOM 75 | - react-router 76 | - 什么是前端路由 77 | - 以往的后端路由是怎么样的 78 | - 基本使用 79 | - redux 80 | - 基本概念 81 | - 基本使用 82 | - react-redux 83 | 84 | ## 推荐书籍 85 | - 《css 设计指南》 86 | - dom 入门书: 《js dom 编程艺术》 87 | - js 进阶小书:[《JavaScript语言精粹》](https://book.douban.com/subject/3590768/)、effective js、 you dont know js 88 | - js 系统厚书:《js 高级程序设计》、《js 权威指南》即犀牛书 89 | - 其他:[《高性能网站建设指南》](http://book.douban.com/subject/3132277/) 90 | 91 | ## 推荐在线学习资料 92 | - git 小白入门:http://www.liaoxuefeng.com/wiki/0013739516305929606dd18361248578c67b8067c8c017b000 93 | - github 博客: https://github.com/CoderUnion/coderunion-github-talk/issues/87 94 | - weibo:https://github.com/CoderUnion/coderunion-github-talk/issues/86 95 | 96 | ## 线上自学模式和捐赠 97 | 线上自学模式,我没有义务改你的作业(code review),不过你可以捐赠我(支付宝>10元),邮件联系我,并告诉我你 github id 即可,我就会 code review 你的每一行代码。 98 | -------------------------------------------------------------------------------- /practice/autoComplete.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplyY/web-front-end-thinking-tutorial/d3b3710832ac167485740eface94043ba7785e55/practice/autoComplete.js -------------------------------------------------------------------------------- /practice/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /practice/lxy/1/1.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Created by Administrator on 2016/3/31. 4 | */ 5 | var a=parseInt('123',10); 6 | console.log(a); 7 | 8 | -------------------------------------------------------------------------------- /practice/lxy/1/2.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * Created by Administrator on 2016/3/31. 5 | */ 6 | var arry1=['1','2']; 7 | var arry2=arry1.map(Number); 8 | 9 | console.log(arry2); 10 | -------------------------------------------------------------------------------- /practice/lxy/1/3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2016/4/3. 3 | */ 4 | 5 | var childCollection = document.querySelectorAll('div'); 6 | var childs = Array.prototype.slice.call(childCollection); -------------------------------------------------------------------------------- /practice/lxy/1/4.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2016/4/3. 3 | */ 4 | function spacify(aa) { 5 | var bb=Array.from(aa) // string to arry 6 | 7 | for(var i=1,len=bb.length;i=i;t--) 12 | bb[t+1]=bb[t] 13 | 14 | bb[i]=' ' 15 | len=len+1 16 | i=i+2 17 | } 18 | if(bb[i]==' ') 19 | i=i+2 20 | } 21 | 22 | cc=bb.join('')//arry to string 23 | console.log(cc) 24 | 25 | } 26 | spacify('helloworld') 27 | spacify('hello world') 28 | spacify('he llo worl d') -------------------------------------------------------------------------------- /practice/lxy/1/5.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2016/4/3. 3 | */ 4 | function change(aa) { 5 | var bb=Array.from(aa) // string to arry 6 | 7 | cc=bb.sort() //对arry排序 8 | 9 | dd=cc.join('') //arry to string 10 | 11 | console.log(dd) 12 | } 13 | 14 | change('cdbae') 15 | -------------------------------------------------------------------------------- /practice/lxy/1/6.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Administrator on 2016/4/3. 3 | */ 4 | var a=["a","b","c","d"]; 5 | for(i=0;i 2 | 3 | 4 |

5 | 6 |
7 |

Search

8 |
9 | 10 | 18 | 19 |
20 | 21 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /practice/machi/1/anwser.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by j on 2016/3/31. 3 | */ 4 | var str1='123'; 5 | var array1; 6 | var res1=parseInt(str1,10); 7 | console.log('the result of q1:'+res1); 8 | 9 | var array = ['1','2']; 10 | var numbers=[]; 11 | array.map( 12 | function(a) 13 | { 14 | numbers.push(parseInt(a)); 15 | } 16 | ) 17 | console.log('the result of q2:'+numbers); 18 | 19 | console.log('the result of q3:please move to index.html'); 20 | 21 | var item='hello world'; 22 | var str4=[]; 23 | function spacify(str){ 24 | str4= str.split(""); 25 | 26 | return str4.join(' ');; 27 | } 28 | var res4=spacify(item); 29 | console.log('the result of q4:'+res4); 30 | 31 | function q4(str){ 32 | var string=[]; 33 | var str5 = []; 34 | string = str.split(""); 35 | var num = string.length; 36 | for(var i=0;i 3 | 4 | 5 | 6 | 7 | 8 | 9 | 30 | 31 | 32 | ======= 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 61 | 62 | >>>>>>> origin/master 63 | -------------------------------------------------------------------------------- /practice/machi/1/note_1.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplyY/web-front-end-thinking-tutorial/d3b3710832ac167485740eface94043ba7785e55/practice/machi/1/note_1.md -------------------------------------------------------------------------------- /practice/machi/2/autoComplete.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimplyY/web-front-end-thinking-tutorial/d3b3710832ac167485740eface94043ba7785e55/practice/machi/2/autoComplete.js -------------------------------------------------------------------------------- /practice/machi/2/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /practice/machi/3/note.md: -------------------------------------------------------------------------------- 1 | 1. import与bind 2 | import 导入某个包里的某个组件,import * from './**',起初有些不懂那个./,后来查了一下js路径,只说了../是到上层目录,然后试了试不加的情况(jsx文件与入口文件在同一目录下)发现也是可以用..就没再纠结; 3 | bind 显式调用 bind(this)将事件函数上下文绑定要组件实例上,有的是bind(this,arg1,agr2..),据说这样的很少出现,this后边的arg们是前边事件处理函数家的参数; 4 | 2. this.props 5 | 文档里说 6 | >React 里有一个非常常用的模式就是对组件做一层抽象。组件对外公开一个简单的属性(Props)来实现功能,但内部细节可能有非常复杂的实现。 7 | 8 | 通常用在静态资料上,让父元件传递资料給子元件而元件內部可以通过this.props 取得該值,就是通过 props 属性传递,在父组件给子组件设置 props,然后子组件就可以通过props 9 |  访问到父组件的数据/方法,这样就搭建起了父子组件间通信的桥梁。 10 | 11 | 还可以使用 [JSX 展开属性](http://reactjs.cn/react/docs/jsx-spread-zh-CN.html) 来合并现有的 props 和其它值; 12 | 13 | 直接在组件中使用key/value的形式来指定属性 14 | 15 | React.render(   16 |     ,   17 |     document.getElementById('container')   18 | );   19 | 20 | 21 | var HelloWorld = React.createClass({   22 |     render: function() {   23 |         return (   24 |             
Hello, {this.props.name}
   25 |         );   26 |     }   27 | });  //通过this.props.name就可以获取name属性值啦 28 |
29 | 3. this.states 30 | React 把组件看成是一个状态机(State Machines)。通过与用户的交互,实现不同状态,然后渲染 UI,让用户界面和数据保持一致。React 里,只需更新组件的 state,然后根据新的 state 重新渲染用户界面(不要操作 DOM)。 31 | 初始化state 可以在组件类的构造函数里搞一下,或者用getInitialState函数(该函数只在组件装载前调用一次); 32 | 33 | 4. this.Setstate 34 | 调用 setState(data, callback)是常用的通知 React 数据变化的方法。这个方法会合并(merge) data到 this.state,并重新渲染组件。渲染完成后,调用可选的 callback 35 |  回调。大部分情况下不需要提供 callback,因为 React 会负责把界面更新到最新状态。 36 | https://facebook.github.io/react/docs/interactivity-and-dynamic-uis-zh-CN.html 37 | 38 | 5. jsx 39 | JSX 写的一个链接: 40 | <--!a href="http://facebook.github.io/react/"-->Hello! 41 | 用 JS 代码来写就成这样了: 42 | React.createElement('a', {href: 'http://facebook.github.io/react/'}, 'Hello!') 43 | 如果要在jsx里插入Js表达式(逻辑啊赋值,比较,算数,按位,字符串)就要加{}; 44 | jsx并没有修改js语义,官方建议jsx(可以简洁且熟知地包含属性的树状结构语法); 45 | 【这部分内容并记不太住…准备用的时候再翻… 46 | 47 | 6. render 48 | reactDom.render() 49 | render(ReactElement,元素 50 | DomElement,要被元素替换的容器 51 | [回调函数],这个是可选的,如果选择了,那么就在元素被渲染后开始执行 52 | ) 53 | 54 | react.render 55 | 在使用render方法时,尽量确保只返回一个节点(节点内可包含任意数目子节点)。而且大多数情况下使用()括号将返回结果包住【我当时往demo里复制过例子,render里放俩标签发现确实会报错…。 56 | 没找到这个的说明,感觉就是函数必须要有返回值,返回一个(父)组件; 57 | >如果不想要渲染任何东西,可以将返回值设置为null或者false. 在这种情况下React实际会渲染一个