判断两个数组是否相等
const isArray = function(arr) {
return Object.prototype.toString.call(arr) === '[object Array]'
}
时间与时间戳转换
const stamp = {
getTime: function(time) { //时间转10位时间戳
let date = time ? new Date(time) : new Date()
return Math.round(date.getTime() / 1000)
},
timeToStr: function(time, fmt) { //10位时间戳转时间
return new Date(time * 1000).pattern(fmt || 'yy-MM-dd')
}
}
判断是否为微信
const isWx = function() {
let ua = window.navigator.userAgent.toLowerCase()
if(ua.match(/MicroMessenger/i) === 'microMessenger') {
return true
}
return false
}