随笔分类 - JavaScript
摘要:GetDateStr (AddDayCount) { let dd = new Date() dd.setDate(dd.getDate() + AddDayCount)// 获取AddDayCount天后的日期 负数为前N天 正数为后N天 // eslint-disable-next-line n
阅读全文
摘要:console.log(Math.floor(2547.2548 * 1000) / 1000) // 2547.254 console.log(Math.floor(2547.2548 * 100) / 100) // 2547.25 console.log(Math.floor(2547.254
阅读全文
摘要:numberToIp (number) { let ip = '' if (number <= 0) { return ip } const ip3 = (number << 0) >>> 24 const ip2 = (number << 8) >>> 24 const ip1 = (number
阅读全文
摘要:const stime = Date.parse(new Date('2020-07-21 15:28:10'))const etime = Date.parse(new Date('2020-07-22 15:31:27'))// 两个时间戳相差的毫秒数const usedTime = etime
阅读全文
摘要:generateUUID () { let d = new Date().getTime() if (window.performance && typeof window.performance.now 'function') { d += performance.now() // use hig
阅读全文
摘要:let arr = [4,3,5,2,1]foi (let i = 0; i <arr.length - 1; i++) { for (let j = 0; j < arr.length - 1 - i; j++) { if (arr[j] < arr[j + 1]) { let swap = ar
阅读全文
摘要:Date.prototype.format = function (fmt) { var o = { 'M+': this.getMonth() + 1, // 月份 'd+': this.getDate(), // 日 'h+': this.getHours(), // 小时 'm+': this
阅读全文
摘要:HTML <el-upload class="avatar-uploader" action="" :show-file-list="false" :on-change="getFile" :limit="1" list-type="picture" :auto-upload="false" > <
阅读全文
摘要:判断是否是顶层窗口(父窗口) 如果不是让其在顶层窗口打开<script type="text/javascript"> if(top.location!=self.location){ top.location.href = self.location.href; } else { // conso
阅读全文