export function sleeping(timeout = 1000) {
return new Promise((resolve) => {
setTimeout(() => {
resolve()
}, timeout)
})
}
/**
* 是否合法数据
* @param value any
*/
export function isNotEmpty(value: any) {
if (value !== undefined && value !== '' && value != null) {
return true
}
return false
}
/**
* 是否非空对象
* @param value any
*/
export function isNotEmptyObject(value: object) {
if (value instanceof Object && Object.keys(value).length > 0) {
return true
}
return false
}
export function IsPC() {
if (process.server) return
const userAgentInfo = navigator.userAgent
const Agents = [
'Android',
'iPhone',
'iPad',
'iPod'
]
let flag = true
for (let v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false
break
}
}
return flag
}
网友评论