
方法库
别抢我小龙虾
这个作者很懒,什么都没留下…
展开
-
数组对象去重
结构类似var hash = {};arr = arr.reduce(function(item, next) { hash[next.name] ? '' : hash[next.name] = true && item.push(next); return item}, [])console.log(arr)原创 2020-10-12 11:46:49 · 150 阅读 · 0 评论 -
关闭eslint
关闭当前行码 // eslint-disable-line关闭下一行// eslint-disable-next-line代码块/* eslint-disable */ // 关闭/* eslint-enable */ // 开启原创 2020-09-09 15:37:07 · 468 阅读 · 0 评论 -
Umi判断当前页面是不是从上一个页面返回
使用history对象来判断,当前页面是链接点进来的,还是从上一个页面按返回按钮回来的import { history } from 'umi';history.action == 'PUSH' //链接点过来的history.action == 'POP' //返回键ps:想要使用该方法,必须使用umi的路由方式,即history.push(地址)或者<Link to={地址}></Link>...原创 2020-09-04 19:52:51 · 2439 阅读 · 1 评论 -
react动态添加iconfont的字符串unicode编码,转译
<i className="iconfont" dangerouslySetInnerHTML={{ __html: item.icon }}></i>原创 2020-08-12 10:20:15 · 1013 阅读 · 0 评论 -
moment常用使用方法记录
平常偶尔使用,特此记录日期格式化moment().format('MMMM Do YYYY, h:mm:ss a'); // 七月 2日 2020, 11:14:42 上午moment().format('dddd'); // 星期四moment().format("MMM Do YY"); // 7月 2日 20moment().format('YYYY [escaped] YYYY'); // 2020 escaped原创 2020-07-02 14:43:40 · 1046 阅读 · 0 评论