| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 | 
							- // 日期时间
 
- import {
 
- 	formatDateTime,
 
- 	formatDate,
 
- 	parseTime
 
- } from "@/unit/datetime.js"
 
- import {
 
- 	add,
 
- 	ride
 
- } from "@/unit/Math.js"
 
- /* 
 
- 	防抖
 
- 	fn : 回调函数  传进来的是正真的业务逻辑
 
- 	delay : 延时时间
 
- */
 
- const antiShake = function(fn, delay) {
 
- 	let time = null; //time用来控制事件的触发
 
- 	return function() {
 
- 		if (time !== null) {
 
- 			clearTimeout(time);
 
- 		}
 
- 		time = setTimeout(() => {
 
- 			fn.call(this);
 
- 			//利用call(),让this的指针从指向window 转成指向input
 
- 		}, delay)
 
- 	}
 
- }
 
- const hideBoard = function() {
 
- 	var interval = setInterval(function() {
 
- 		uni.hideKeyboard();
 
- 	}, 100);
 
- 	setTimeout(() => {
 
- 		clearInterval(interval);
 
- 	}, 2000);
 
- };
 
- export {
 
- 	antiShake,
 
- 	hideBoard,
 
- 	formatDateTime,
 
- 	formatDate,
 
- 	parseTime,
 
- 	add,
 
- 	ride
 
- }
 
 
  |