会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
青云码上
博客园
首页
新随笔
联系
订阅
管理
上一页
1
2
3
4
5
6
7
8
···
10
下一页
2021年12月13日
数组去重(根据对象属性去重)
摘要: 普通去重 [...new Set(arr)] 根据对象属性值去重 function unique(arr,u_key) { let map = new Map() arr.forEach((item,index)=>{ if (!map.has(item[u_key])){ map.set(item
阅读全文
posted @ 2021-12-13 15:44 青云码上
阅读(200)
评论(0)
推荐(0)
2021年9月28日
Element.scrollIntoView()
摘要: Element 接口的scrollIntoView()方法会滚动元素的父容器,使被调用scrollIntoView()的元素对用户可见。 语法 element.scrollIntoView(); // 等同于element.scrollIntoView(true) element.scrollInt
阅读全文
posted @ 2021-09-28 11:21 青云码上
阅读(160)
评论(0)
推荐(0)
2021年8月30日
常用正则校验
摘要: 匹配中文:/[\u4e00-\u9fa5]/ 匹配表情:/(\ud83c[\udf00-\udfff])|(\ud83d[\udc00-\ude4f\ude80-\udeff])|[\u2600-\u2B55]/ 匹配手机号:/^[1][3,4,5,6,7,8,9][0-9]{9}$/ 匹配座机:/
阅读全文
posted @ 2021-08-30 20:46 青云码上
阅读(130)
评论(0)
推荐(0)
2021年8月18日
js下载文件
摘要: index.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <titl
阅读全文
posted @ 2021-08-18 11:10 青云码上
阅读(1063)
评论(0)
推荐(0)
2021年5月19日
控制animation暂停:animation-play-state
摘要: .active { animation-play-state: running; } .paused { animation-play-state: paused; } IOS低版本机型不支持animation-play-state 兼容写法: @supports not(animation-pla
阅读全文
posted @ 2021-05-19 15:45 青云码上
阅读(201)
评论(0)
推荐(0)
2021年5月13日
苹果手机 z-index 失效
摘要: 原因: 在苹果手机上, transform 变换的时候会让 z-index “临时失效”,其实并非 z-index 失效了,只是 z-index 被用在不同的 stacking context 上,而非在默认的 context 上同等地比较层级了。所以 DOM 在 transform 的工程中,DO
阅读全文
posted @ 2021-05-13 19:39 青云码上
阅读(876)
评论(0)
推荐(0)
2021年5月5日
手写flat
摘要: let arr = [1,[2,3,[4]],5,6,[7,[8],[9,10,[11],12]]]; Array.prototype.myFlat = function(n){ let newArr = []; this.forEach(item=>{ if(Array.isArray(item)
阅读全文
posted @ 2021-05-05 17:14 青云码上
阅读(133)
评论(0)
推荐(0)
2021年4月28日
简单版手写promiss,包含resolve,reject,then链式调用
摘要: // 要模拟promise的构造函数 function MyPromise(fn) { this.data = null; // 要resolve的数据 this.err = null; // 要reject的数据 this.resolveCallback = null; // 存放resolve的
阅读全文
posted @ 2021-04-28 21:34 青云码上
阅读(190)
评论(0)
推荐(0)
2021年4月21日
使用@supports完美兼容CSS属性
摘要: 今天写微信小程序遇到一个问题:给page加 150rpx 的 padding-bottom 值,我考虑到 iphone X 系列的底部黑线,参考我之前写的css属性——env()和constant()设置安全区域;所以我这样写: page{ padding-bottom: calc( constan
阅读全文
posted @ 2021-04-21 19:58 青云码上
阅读(3069)
评论(0)
推荐(0)
2021年4月17日
fetch请求文件流并下载(Excel)
摘要: 1、blob文件流 fetch(url,{ method: 'get', responseType: 'blob' }).then(res => { return res.blob(); }).then(blob => { let bl = new Blob([blob], {type: "appl
阅读全文
posted @ 2021-04-17 19:55 青云码上
阅读(1562)
评论(0)
推荐(0)
上一页
1
2
3
4
5
6
7
8
···
10
下一页
公告