- 博客(13)
- 资源 (2)
- 收藏
- 关注
原创 一键页面变灰
最近几天,大家有没有发现大部分网站都瞬间变灰色了。由于xxxx,国家降半旗,几乎所有的知名网站,首页都变成灰色的了。可能有许多小伙伴好奇这是怎样做到的?其实很简单,前端工程师们只需要一行代码就可以解决。我们只需要在网站的首页后台代码加入这么一段代码,就可以实现了!还有其他的效果,我就不一一列举了,就是这么神奇,都去试试看。今天是2022年12月2号。
2022-12-02 15:40:46
230
原创 使用class 手写一个promise
/创建一个Promise的类 class Promise{ constructor(executer){//构造函数constructor里面是个执行器 this.status = 'pending';//默认的状态 pending this.value = undefined//成功的值默认undefined this.reason = undefined//失败的值默认undefined //状态只有在pending时候才能改变 l
2022-03-24 16:01:37
960
原创 浏览器滚动条样式修改
*::-webkit-scrollbar {/滚动条整体样式/width: 7px;height: 7px;}::-webkit-scrollbar-thumb {/滚动条里面小方块/background-color: #c8d2e0;/ border-radius: 2px;box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.2); */border-radius: 10px;}*::-webkit-scrollbar-track {/滚动条里面轨
2022-03-14 10:14:46
237
原创 2021-07-22
常用的JavaScript函数片段***浏览器对象 BOM***Cookie***日期 Date***文档对象 DOM***数字 Number****交流**数组去重function noRepeat(arr) { return [...new Set(arr)];}2.查找数组最大function arrayMax(arr) { return Math.max(...arr);}3.查找数组最小function arrayMin(arr) { return Math.m
2021-07-22 11:52:11
137
原创 获取日期
var date = new Date();date .getYear(); //获取当前年份(2位)date .getFullYear(); //获取完整的年份(4位)date .getMonth(); //获取当前月份(0-11,0代表1月)date .getDate(); //获取当前日(1-31)date .getDay(); //获取当前星期X(0-6,0代表星期天)date .getTime(); //获取当前时间(从1970.1.1开始的毫秒数)date .getHours();
2021-05-10 13:27:09
167
原创 vue路由拦截
beforeRouteLeave(to,form ,next){ if(this.path==to.path){ next("/dormitory-Building") }else { next() } }, beforeRouteEnter(to,form ,next){ next((vm) => { .
2021-02-06 11:43:40
129
原创 Vue中生成二维码,并保存为图片
Vue中生成二维码,并保存为图片首先需要安装qrcodejs2插件yarn add qrcodejs2 <div id="qrCode" ref="qrCodeDiv" v-show="false"></div> //说明: v-show="false"隐藏,当为真是,显示 //二维码生成 bindQRCode(val) { new QRCode(this.$refs.qrCodeDiv
2021-01-06 11:40:44
2285
原创 逗号拼接字符串
逗号拼接字符串 let val =[ { id:'1', name:'张三' }, { id:'2', name:'李四' }, { id:'3', name:'王五' }, ] Joining(val) { if (val.length > 0)
2021-01-05 16:03:11
672
原创 ES6,对象去重
ES6,对象去重let Arr=[ {"id":"1","name":"张三1"}, {"id":"2","name":"张三2"}, {"id":"3","name":"张三3"}, {"id":"1","name":"张三1"} ] function unique(arr){ const res =new Map(); return arr.filter((a)=> !res.
2021-01-05 15:53:38
783
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人