合集-JS函数库

摘要:1 // 1、定义一个随机颜色函数,如果输入true(默认), 2 // 返回#ffffff;;false返回rbg 3 function getRandomColor(flag = true) { 4 if(flag){ 5 const arr = ['0','1','2','3','4','5' 阅读全文
posted @ 2023-05-10 11:30 Agiser0 阅读(68) 评论(0) 推荐(0)
摘要:1 // 封装日期函数 2 function getDatetime() { 3 const date = new Date() 4 let years = date.getFullYear() 5 let month = date.getMonth() + 1 6 month = month < 阅读全文
posted @ 2023-05-10 11:33 Agiser0 阅读(17) 评论(0) 推荐(0)
摘要:1 //封装得到时间的函数 2 function getTime() { 3 // 得到时间戳之差 4 let now = +new Date() 5 let after = +new Date('2023-4-20 00:00:00') 6 //得到秒数的时间差 7 let count = (af 阅读全文
posted @ 2023-05-10 11:35 Agiser0 阅读(44) 评论(0) 推荐(0)