06 2018 档案
angularjs指令中的scope
摘要:共享 scope 使用共享 scope 的时候,可以直接从父 scope 中共享属性。因此下面示例可以将那么属性的值输出出来。使用的是父 scope 中定义的值。 js代码: html代码 输出结果: 隔离 scope 使用隔离 scope 的时候,无法从父 scope 中共享属性。因此下面示例无法 阅读全文
posted @ 2018-06-29 16:25 chenlw101 阅读(222) 评论(0) 推荐(1)
自动化工具gulp搭建环境(详解)
摘要:src:读取文件和文件夹 dest:生成文件(写文件) watch:监控文件 task:定制任务 pipe:以流的方式处理文件 bower的安装和使用 使用bower要求先安装node,请先安装node。 全局安装bower 打开cmd,运行命令 创建bower配置文件 控制台进入你项目所在文件的目 阅读全文
posted @ 2018-06-28 11:06 chenlw101 阅读(287) 评论(0) 推荐(0)
gulp常用插件
摘要:匹配符 *、**、!、{} 文件操作 del (替代gulp-clean) gulp-rename 描述:重命名文件 gulp-concat 描述:合并文件。 gulp-filter 描述:在虚拟文件流中过滤文件。 压缩 gulp-uglify 描述:压缩js文件大小。 gulp-csso 描述:压 阅读全文
posted @ 2018-06-28 09:34 chenlw101 阅读(130) 评论(0) 推荐(0)
多表查询
摘要:内连接 外连接 阅读全文
posted @ 2018-06-27 14:18 chenlw101 阅读(93) 评论(0) 推荐(0)
数据库单表查询详解
摘要://数据库分页 LIMIT 0,5;//表示从第一条开始的5条数据,默认0为第一条 LIMIT 5,5;//若是5个为一页,那么前5个到4,后5个从5开始 阅读全文
posted @ 2018-06-27 11:29 chenlw101 阅读(153) 评论(0) 推荐(0)
angularjs的路由ui.router
摘要:路径可以是{ '/home':只匹配'/home' '/user/id'、'user/{id}':匹配 '/user/123'或者'/user/' } 阅读全文
posted @ 2018-06-26 15:51 chenlw101 阅读(121) 评论(0) 推荐(0)
es6(16)--Decorator
摘要: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 阅读(123) 评论(0) 推荐(0)
es6(14)--iterator for ...of循环
摘要: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 阅读(109) 评论(0) 推荐(0)
es6(15)--generator
摘要: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 阅读(108) 评论(0) 推荐(0)
es6(13)--Promise
摘要: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 阅读(136) 评论(0) 推荐(0)
es6(12)--类,对象
摘要: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 阅读(111) 评论(0) 推荐(0)
es6(11)--Proxy,Reflect
摘要: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 阅读(119) 评论(0) 推荐(0)
es6(10)--Set,Map(2)
摘要: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 阅读(94) 评论(0) 推荐(0)
es6(10)--Set,Map(1)
摘要: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 阅读(107) 评论(0) 推荐(0)
es6(9)--Symbol
摘要: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 阅读(114) 评论(0) 推荐(0)
es6(8)--对象
摘要: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 阅读(94) 评论(0) 推荐(0)
es6基础(7)--函数扩展
摘要:1 { 2 //有默认值的后面如果有参数必须要有默认值 3 function test(x,y="world"){ 4 console.log(x,y) 5 } 6 test('hello');//hello world 7 test('hello',"kill");//hello kill 8 9 } 10 { 11 ... 阅读全文
posted @ 2018-06-21 17:22 chenlw101 阅读(144) 评论(0) 推荐(0)
es6基础(6)--数组扩展
摘要:1 //数组扩展 2 { 3 let arr=Array.of(3,4,6,7,9,11);//可以是空 4 console.log('arr=',arr);//[3,4,6,7,9,11] 5 } 6 { 7 //Array.from把伪数组或者集合变为数组 8 let p=document.querySelectorAll('p'); 9 ... 阅读全文
posted @ 2018-06-21 16:10 chenlw101 阅读(132) 评论(0) 推荐(0)
es6基础(5)--数值扩展
摘要:1 { 2 //Number.isFinite数字是有尽的 3 console.log(Number.isFinite(15));//true 4 console.log(Number.isFinite(NaN));//false 5 console.log(Number.isFinite('true'/0));//false 6 co... 阅读全文
posted @ 2018-06-21 15:39 chenlw101 阅读(109) 评论(0) 推荐(0)
es6基础(4)--字符串扩展
摘要:1 //字符串扩展 2 { 3 console.log('a','\u0061'); 4 console.log('s','\u20BB7');//超过了0xffff 5 6 console.log('s','\u{20BB7}');//如果超过就用{}包裹 7 8 } 9 { 10 //es5中 11 let s='𠮷'; 12 ... 阅读全文
posted @ 2018-06-21 15:08 chenlw101 阅读(116) 评论(0) 推荐(0)
es6基础(3)-正则扩展
摘要:1 //正则扩展 2 { 3 let regex=new RegExp('xyz','i'); 4 let regex2=new RegExp(/xyz/i); 5 6 console.log(regex.test('xyz123'),regex2.test('xy')); 7 //后面的修饰符i覆盖原来的ig修饰符 8 let rege... 阅读全文
posted @ 2018-06-21 14:09 chenlw101 阅读(98) 评论(0) 推荐(0)
es6基础(2)--解构赋值
摘要:1 //解构赋值 2 3 { 4 let a,b,rest; 5 [a,b]=[1,2]; 6 console.log(a,b); 7 } 8 //数组解构赋值 9 { 10 let a,b,rest; 11 [a,b,...rest]=[1,2,3,4,5,6]; 12 console.log(a,b,rest); 13 } ... 阅读全文
posted @ 2018-06-21 13:33 chenlw101 阅读(139) 评论(0) 推荐(0)
es6基础(1)--声明
摘要:1 function test(){ 2 //let只在块作用域有效 3 for(let i=1;i<3;i++){ 4 console.log(i); 5 } 6 //es6严格模式,变量未声明,不可以用 7 //console.log(i); 8 //let 里面不可以声明两个相同的变量 9 let a... 阅读全文
posted @ 2018-06-21 11:35 chenlw101 阅读(86) 评论(0) 推荐(0)
gulp安装,淘宝镜像
摘要:命令:express -e ./ express表示安装express -e表示使用ejs作为模板 ./表示当前目录中 (使用上面的命令之前我们应该使用npm安装express框架 sudo npm install -g express sudo npm install -g express-gen 阅读全文
posted @ 2018-06-20 16:43 chenlw101 阅读(146) 评论(0) 推荐(0)
获取图片src
摘要:用jquery获取图片src(不知道为什么总是undefined): $('img').eq(i).src; $('img').eq(i).attr('src'); //上面两种都是获取不到,不知道为什么 最后用 var src=document.getElementsByTagName('img' 阅读全文
posted @ 2018-06-20 10:56 chenlw101 阅读(261) 评论(0) 推荐(0)
web分页打印
摘要:添加css: page-break-before:always 实现分页 window.print()//实现打印 阅读全文
posted @ 2018-06-19 14:54 chenlw101 阅读(112) 评论(0) 推荐(0)
php添加多组数据到数据库
摘要://添加sql的数据 $sqldatas=getParam('sqldatas');//这里的sqldatas是从前台传过来的json字符串 //将json字符串转为json对象 $sqldata=json_decode($sqldatas,true); //插入多个值的时候 $sql= "INSE 阅读全文
posted @ 2018-06-19 10:38 chenlw101 阅读(932) 评论(0) 推荐(0)
angularjs中ng-repeat插入图片
摘要:<tr ng-repeat="item in datas" ng-module="datas"> <td> <img class ="img" ng-src="{{item.picurl}}"> </td> </tr> 可以使用ng-src来repeat图片 阅读全文
posted @ 2018-06-19 10:28 chenlw101 阅读(258) 评论(0) 推荐(0)