- 博客(14)
- 收藏
- 关注
转载 DataURL与File,Blob,canvas对象之间的互相转换的Javascript
canvas转换为dataURL (从canvas获取dataURL)var dataurl = canvas.toDataURL('image/png');var...
2019-06-03 09:46:17 304
原创 自行搭建服务启动时:TypeError: Cannot destructure property `compile` of 'undefined' or 'null'
一.描述进入到VUE项目运行命令错误提示:TypeError: Cannot destructure property `compile` of 'undefined' or 'null'二.分析经过分析,发现是因为webpack-dev-server版本过高导致。三.解决方法进入到项目中,运行如下命令:npm install -D webpack-dev-server@...
2019-01-29 21:20:36 6424
原创 vue init webpack my-project 报错:npm ERR! Unexpected end of JSON input while parsing near '...44,"noat
vue init webpack my-project 报错:npm ERR! Unexpected end of JSON input while parsing near '...44,"noattachment":fal'解决方案: npm cache clean --force ...
2018-06-10 15:06:22 2197
原创 随机某一范围整数 颜色随机
function randNum(m,n){ return Math.round(Math.random()*(n-m)+m)}var color = "rgb("+randNum(0,255)+","+randNum(0,255)+","+randNum(0,255)+")"
2018-05-18 19:37:34 296
原创 cursor:url(路径),auro IE兼容问题
在项目中用到cursor需要自定义样式,用到cursor:url(路径),auto;路径里写上以.ico结尾的格式,在IE浏览器下不支持;后来改为.cur结尾的格式,可以正常显示
2018-05-10 17:43:45 1448
原创 selected="selected"无效的解决办法
在开发中发现用拼接的方式组合的select,设置selected="selected"没有效果,总是会显示最后一项,最后通过三目运算解决了浏览器显示如下:
2018-04-27 18:49:09 6996 2
原创 input file 使用onchange事件
在做表单上传时,选择文件后,要显示文件的路径,但是连续选择同一个文件的话,第二次不显示文件路径,解决方法:上传后将input的值设为空, input.value='';...
2018-04-23 19:07:12 31660 1
原创 $(...).css is not a function
在用mui框架开发app时,有一次控制台报错”$(...).css is not a function“解决:将$换成jQuery
2018-04-23 19:02:46 8068 1
原创 提交file
在IE浏览器下上传文件,需要直接进行点击<input type="file">标签,不能通过其他事件间接触发<input type="file" name="upFile" onchange="fnChang(this)"/><input type="hidden" class="fileName" />f
2018-04-20 18:27:10 708
原创 IE9不支持console.log
在使用dataTable插件时,在IE9操作时,写了console.log打印数据,但是程序不执行,F12调出控制台,程序会继续执行,后来把console.log筛除后,程序可以继续执行了,查阅资料后发现 如果在IE8/9,要考虑兼容问题,用if (window.console) { ... }包住console.log()动作。...
2018-04-17 12:09:38 1434
原创 在data-自定义属性里写函数
H5的data-自定义属性里面是字符串类型,如果写上函数的话是不被识别的,可以使用eval;这里可以使用eval:
2018-03-20 17:51:35 1049
原创 previousElementSibling的使用
在项目中有一个非空验证,可以利用previousElementSibling;previousElementSibling指的是上一个兄弟元素节点;
2018-03-13 10:27:03 2642
原创 自定义弹框
var pro=function(tit,fn){ if($('.box').length>0){ return false }else{ var box=''; box +='<div class="box"><div class="con"><p class="clos">X</p><p>
2018-03-10 17:11:33 137
原创 根据业务需求创建不同的tr
在项目中有一个功能是点击增加按钮,新增一行;实现代码如下:思路:创建一个干净的模板,设置其隐藏,按钮点击时复制此模板;其次要保证每次创建的tr的class不能相同. var i=0; $('body').on('click','addBtn',function(){ $(".trr").eq(0).clone().attr("class","trr"+i).remove...
2018-03-10 16:22:29 208
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人