摘要: 防抖函数(可用于防止重复提交) 当持续触发事件时,一定时间段内没有再触发事件,事件处理函数才会执行一次, 如果设定时间到来之前,又触发了事件,就重新开始延时。也就是说当一个用户一直触发这个函数,且每次触发函数的间隔小于既定时间,那么防抖的情况下只会执行一次。 节流函数 当持续触发事件时,保证在一定时 阅读全文
posted @ 2019-10-23 17:48 甜粽子 阅读(1890) 评论(0) 推荐(1) 编辑
摘要: //阿拉伯数字转中文数字 function NoToChinese(num) { if (!/^\d*(\.\d*)?$/.test(num)) { alert("Number is wrong!"); return "Number is wrong!"; } var AA = new Array("零", "一", "二", "三", "... 阅读全文
posted @ 2019-10-23 17:37 甜粽子 阅读(11589) 评论(0) 推荐(1) 编辑
摘要: /** * for vue: 日期格式化 **/function dateFormat(value, format) { if (typeof(value) == "undefined" || value == null || value == '') { return value; } var date = new Date(value); ... 阅读全文
posted @ 2019-10-23 17:34 甜粽子 阅读(698) 评论(0) 推荐(0) 编辑
摘要: /** * 毫秒转换友好的显示格式 * 输出格式:21小时前 * stringTime为:年-月-日 时:分:秒 * @param {[type]} time [description] * @return {[type]} [description] */function friendlyFormatTime(stringTime) { let minute = 1000 * 60; let h 阅读全文
posted @ 2019-10-23 17:31 甜粽子 阅读(959) 评论(0) 推荐(1) 编辑
摘要: 1 /* 动画名称 */ 2 animation-name: cloud; 3 /* 属性定义动画完成一个周期所需要的时间,以秒或毫秒计 */ 4 animation-duration:1s; 5 /* 属性定义动画何时开始 */ 6 animation-delay: 0s; 7 /* 规定动画的速 阅读全文
posted @ 2019-10-23 17:13 甜粽子 阅读(347) 评论(0) 推荐(1) 编辑