随笔分类 -  JavaScript

摘要:GetDateStr (AddDayCount) { let dd = new Date() dd.setDate(dd.getDate() + AddDayCount)// 获取AddDayCount天后的日期 负数为前N天 正数为后N天 // eslint-disable-next-line n 阅读全文
posted @ 2022-03-21 09:53 sosolucky 阅读(1265) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2022-02-23 10:37 sosolucky 阅读(35) 评论(0) 推荐(0) 编辑
摘要:numberToIp (number) { let ip = '' if (number <= 0) { return ip } const ip3 = (number << 0) >>> 24 const ip2 = (number << 8) >>> 24 const ip1 = (number 阅读全文
posted @ 2020-08-26 14:33 sosolucky 阅读(578) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-07-20 15:46 sosolucky 阅读(1794) 评论(0) 推荐(0) 编辑
摘要:generateUUID () { let d = new Date().getTime() if (window.performance && typeof window.performance.now 'function') { d += performance.now() // use hig 阅读全文
posted @ 2020-04-20 10:03 sosolucky 阅读(257) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2020-02-26 11:20 sosolucky 阅读(258) 评论(0) 推荐(0) 编辑
摘要:Date.prototype.format = function (fmt) { var o = { 'M+': this.getMonth() + 1, // 月份 'd+': this.getDate(), // 日 'h+': this.getHours(), // 小时 'm+': this 阅读全文
posted @ 2019-12-20 15:58 sosolucky 阅读(288) 评论(0) 推荐(0) 编辑
摘要:HTML <el-upload class="avatar-uploader" action="" :show-file-list="false" :on-change="getFile" :limit="1" list-type="picture" :auto-upload="false" > < 阅读全文
posted @ 2019-11-14 17:18 sosolucky 阅读(1283) 评论(0) 推荐(0) 编辑
摘要:判断是否是顶层窗口(父窗口) 如果不是让其在顶层窗口打开<script type="text/javascript"> if(top.location!=self.location){ top.location.href = self.location.href; } else { // conso 阅读全文
posted @ 2019-08-13 09:23 sosolucky 阅读(429) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示