![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
代码笔记
不爱学习的小鹏同学
放弃有15笔,坚持有16笔,其实坚持只比放弃多一点,为什么不坚持下去呢?
展开
-
时间格式化
export function formatDate(date, fmt) { //获取年份 //y+ => 一个或者多个 //y* => 零个或者多个 // y? => 0个或者1个 if (/(y+)/.test(fmt)) { // substr 截取 fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length)); } let o.原创 2021-09-02 15:39:10 · 55 阅读 · 0 评论 -
实现防抖功能
export function debounce(fun, time=200) { //防抖 let Time = null return function (...args) { //Time不为null 清空Time if(Time){clearTimeout(Time)} Time = setTimeout(() => { fun.apply(this, args) },time) }}原创 2021-09-02 15:40:30 · 78 阅读 · 0 评论 -
vue数值格式化
格式化前格式化后代码块filters: { numberFormat: function (value) { let unit = ''; var k = 10000, sizes = ['', '万', '亿', '万亿'], i; if(value < k){ value =value; }else{ i = Math.floor(Math.log(value) / M...原创 2021-09-02 16:32:45 · 486 阅读 · 0 评论 -
css 文字过长转化为省略号
<p class="title">这里是很长很长的一句话</p>.title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis;}原创 2021-09-03 02:25:53 · 178 阅读 · 0 评论 -
uni-app 应用退出
if (plus.os.name.toLowerCase() === 'android') { plus.runtime.quit(); } else { const threadClass = plus.ios.importClass("NSThread"); const mainThread = plus.ios.invoke(threadClass, "mainThread"); plus.ios.invoke(mainThread, "exi.原创 2021-09-03 18:18:08 · 415 阅读 · 0 评论