第一种: class App extends Component { constructor(props){ super(props); this.state = { show:true } this.showFun = this.showFun.bind(this) } showFun(){ thi...
vue cli3.0用axios调用本地json数据一直报404
vue cli3.0用axios调用本地json数据一直报404 最近在基于vue做后台管理系统时,用了vue cli3.0用axios调用本地json数据一直报404,市面上所有的解决办法都没用,快崩溃了,结果最后发现原因是,vue cli3.0 publi...
最近熟悉jq的extend写法,封装了一个简单的移动端提示插件。
最近熟悉jq的extend写法,封装了一个简单的移动端提示插件。 html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content...
移动端 1px解决方案【mui目前在用的方案】
.gift-tab-title{ height:0.515rem; background: #fff; position:fixed; top:0; left:0; right:0; z-index: 99; } .gift-tab-title:after { content:""; position:absolute; z-index:2; ...
你不一定知道的几个前端小知识
1 大家都知道js在进行小数运算时会有丢失精度问题(其他语言也是),比如: 0.1+0.2 //0.30000000000000004 有一种比较快捷的方式是先把小数乘以10的整数倍,然后再运算,如: (0.1*10+0.2*10)/10 ...
[转]Array.prototype.slice.call()详解及转换数组的方法
在翻看以前公司留下的项目时,看到一段代码。 var $show=$imgList.filter(':visible'); var showPics=Array.prototype.slice.call('$show',0); 1 2 其中第二行虽然能猜出大意,但也有一些费解,不知...
最简单的判断移动端还是pc端
isMobile = 'ontouchstart' in document; if(isMobile){ alert("移动端"); }else{ alert("pc端"); } 最简单的判断移动端还是pc端
动态给html页面图片、css、js链接添加时间戳
动态给html页面图片、css、js链接添加时间戳 虽然这种办法最垃圾(增加服务器负担),但是在没有用自动化工具的时候还是可以用一用。 /** * [addVersion 动态添加时间戳,防止缓存] * @param {[string]} ...
css3点击翻转展示卡片效果
<!DOCTYPE html> <html > <head> <title>test</title> <meta http-equiv="content-type" content="text/html" charset="utf-8"> <meta name="author" c...
用lodash实现*隐藏手机号中间位数
let nb = '13988888888'; let tel = nb.split(''); let res = _.fill(tel,'*',3,tel.length-4); console.log(res.join('')); 用lodash实现*隐藏手机号中间位数