摘要: 路径可以是{ '/home':只匹配'/home' '/user/id'、'user/{id}':匹配 '/user/123'或者'/user/' } 阅读全文
posted @ 2018-06-26 15:51 chenlw101 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1 //Decorator:修饰器,是一个函数用来修改类的行为 2 { 3 //只读 4 let readonly=function(target,name,descriptor){ 5 descriptor.writable=false; 6 return descriptor; 7 }; 8 class Test... 阅读全文
posted @ 2018-06-26 10:34 chenlw101 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 1 //iterator for ...of循环 2 { 3 let arr=['hello','world']; 4 let map=arr[Symbol.iterator](); 5 console.log(map.next()) 6 console.log(map.next()) 7 console.log(map.next()) ... 阅读全文
posted @ 2018-06-26 10:32 chenlw101 阅读(102) 评论(0) 推荐(0) 编辑
摘要: 1 //generator处理异步,下一步用next,遇到return或者yied就会停止 2 { 3 //generator基本定义 4 let tell=function* (){ 5 yield 'a'; 6 yield 'b'; 7 return 'c' 8 }; 9 le... 阅读全文
posted @ 2018-06-26 10:32 chenlw101 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1 //Promise 2 3 { 4 //原始方法 5 let ajax=function(callback){ 6 console.log('执行') 7 setTimeout(function(){ 8 callback&&callback.call() 9 },1... 阅读全文
posted @ 2018-06-26 10:31 chenlw101 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 1 //类,对象 2 { 3 //基本定义和生成实例 4 class Parent{ 5 //定义构造函数 6 constructor(name='QQQ'){ 7 this.name=name; 8 } 9 } 10 let v_parent=new Parent('v')... 阅读全文
posted @ 2018-06-26 10:30 chenlw101 阅读(100) 评论(0) 推荐(0) 编辑
摘要: 1 //Proxy,Reflect 2 3 { 4 let obj={ 5 time:'2018-06-25', 6 name:'net', 7 _r:123 8 }; 9 let monitor = new Proxy(obj,{ 10 //拦截对象属性的读取 11... 阅读全文
posted @ 2018-06-26 10:29 chenlw101 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 1 //Map与Array的对比 2 { 3 let map=new Map(); 4 let array=[]; 5 //增 6 map.set('t',1); 7 array.push({t:1}); 8 console.info('map-Array',map,array); 9 //查 10 let map... 阅读全文
posted @ 2018-06-26 10:28 chenlw101 阅读(84) 评论(0) 推荐(0) 编辑
摘要: 1 //Set 2 { 3 let list=new Set(); 4 list.add(5);//添加 5 list.add(7); 6 //属性size就是长度 7 console.log('size',list.size);//2 8 } 9 { 10 let arr = [1,2,3,4,5]; 11 let li... 阅读全文
posted @ 2018-06-26 10:27 chenlw101 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 1 //Symbol生成一个独一无二的值,生成的值不会相等 2 { 3 //声明1 4 let a1=Symbol(); 5 let a2=Symbol(); 6 console.log(a1===a2);//false 7 //声明2 8 let a3=Symbol.for('a3'); 9 let a4=Symbol.... 阅读全文
posted @ 2018-06-26 10:26 chenlw101 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 1 //对象 2 { 3 //简洁表示法 4 let o = 1; 5 let k = 2; 6 let es5 = { 7 o:o, 8 k:k 9 }; 10 let es6 = { 11 o, 12 k 13 }; 14 console.log(... 阅读全文
posted @ 2018-06-26 10:25 chenlw101 阅读(81) 评论(0) 推荐(0) 编辑