随笔分类 - javascript
摘要:思路: 通过input标签获取本地图片 把获取到的图片转换成base64格式(canvas只能处理base64格式的图片) 通过canvas的API把图片压缩大小后再生成图片。 把压缩后的base64图片转成Blob的二进制流文件。 通过FormData 表单上传的形式提交至后端。 <!DOCTYP
阅读全文
摘要:// ******字段说明******* // value:必须,代表当前元素,其他四个参数都是可选 // index代表当前索引值 // arr代表当前的数组 // thisValue代表传递给函数的值, 一般用this值,如果这个参数为空,undefined会传递给this值 // ******
阅读全文
摘要:1,使用正则表达式,“zhang-san” => ‘san-zhang’。 'zhang-san'.replace(/(\w+)-(\w+)/,'$2-$1'); 2,生产环境如何解决跨域问题? 1,Nginx 代理转发,2,后端程序代理,3,CORS 跨源资源共享。4,jsonp 本地代理配置:V
阅读全文
摘要:Lodash是一个一致性、模块化、高性能的 JavaScript 实用工具库。 网址:https://www.lodashjs.com/ JavaScript 日期处理类库 JavaScript 日期处理类库 网址:http://momentjs.cn/
阅读全文
摘要:Git操作的过程中突然显示 Another git process seems to be running in this repository, e.g.an editor opened by 'git commit'. Please make sure all processesare term
阅读全文
摘要:Vue: ref 传值 父组件<test1 ref="AAA"></test1>子组件<img ref="BBB" /> methods:{ afun(){ ... } } if (this.$refs.AAA) { this.$refs.AAA.$refs.BBB.src = "xxx"; thi
阅读全文
摘要:node爬虫很有意思,看大神都是各种爬小说,爬图片,爬视频等等。自己也是刚了解,希望可以共同学习~ 代码如下: 安装Node.js http://nodejs.org/download/ 安装依赖包 npm install xxxxxx 运行程序 node app.js
阅读全文
摘要:window.location.pathname //设置或获取对象指定的文件名或路径window.location.href //设置或获取整个 URL 为字符串 window.location.origin // 获取当前页面的域名window.location.port //设置或获取与 UR
阅读全文
摘要:store.js 是一个实现了浏览器的本地存储的 JavaScript 封装 API,不是通过 Cookie 和 Flash 技术实现,而是使用 localStorage、globalStorage 和 userData 行为。 示例代码: GitHub地址:https://github.com/m
阅读全文
摘要:(function () { function o() { document.documentElement.style.fontSize = (document.documentElement.clientWidth ) / 31.25 + "px" } var e = nu...
阅读全文