/* * @Author: your name * @Date: 2020-10-09 09:49:38 * @LastEditTime: 2020-11-05 14:58:56 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \sie-irradiator-ui\src\utils\utilsFn.js */ // 图表无数据 export const chartsNoData = () => { return { title: { text: '暂无数据', left: '45%', top: '50%', textStyle: { color: '#c6c6c6', fontWeight: 'bold', fontSize: 28, }, }, } } // 防抖 export const Debounce = (fn, t) => { let delay = t || 300 let timer return function () { let args = arguments if (timer) clearTimeout(timer) timer = setTimeout(() => { timer = null fn.apply(this, args) }, delay) } } // 节流 export const Throttle = (fn, t) => { let last let timer let interval = t || 300 return function () { console.log(arguments) let args = arguments let now = +new Date() if (last && now - last < interval) { clearTimeout(timer) timer = setTimeout(() => { last = now fn.apply(this, args) }, interval) } else { last = now fn.apply(this, args) } } } // 判断对象的值是否都为空值 export const objectValueAllEmpty = (object) => { var isEmpty = true Object.keys(object).forEach((key) => { if (object[key] !== null && object[key] !== '') isEmpty = false }) if (isEmpty) //值全为空 return true return false }