baozhengrui

导航

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页

2024年9月10日 #

过滤对象中为空的属性

摘要: /** * 过滤对象中为空的属性 * @param obj * @returns {*} */ export function filterObj(obj) { if (!(typeof obj == 'object')) { return } for (var key in obj) { if ( 阅读全文

posted @ 2024-09-10 10:12 芮艺 阅读(17) 评论(0) 推荐(0)

获取年份数组 默认5年

摘要: /* 获取年份数组 默认5年*/ export function getYear(num = 5) { const curYear = new Date().getFullYear() let arr = [] for (let i = curYear; i > curYear - num; i-- 阅读全文

posted @ 2024-09-10 10:11 芮艺 阅读(38) 评论(0) 推荐(0)

下划线转驼峰

摘要: /** * 下划线转驼峰 * @param string * @returns {*} */ export function underLine2CamelCase(string) { return string.replace(/_([a-z])/g, function(all, letter) 阅读全文

posted @ 2024-09-10 10:07 芮艺 阅读(9) 评论(0) 推荐(0)

随机生成uuid

摘要: /** * 随机生成uuid * @return string 生成的uuid */ export function randomUUID() { let chats = '0123456789abcdef' return randomString(32, chats) } 阅读全文

posted @ 2024-09-10 10:06 芮艺 阅读(17) 评论(0) 推荐(0)

随机生成字符串

摘要: /** * 随机生成字符串 * @param length 字符串的长度 * @param chats 可选字符串区间(只会生成传入的字符串中的字符) * @return string 生成的字符串 */ export function randomString(length, chats) { i 阅读全文

posted @ 2024-09-10 10:06 芮艺 阅读(28) 评论(0) 推荐(0)

返回年月日

摘要: //返回年月日 getYTime(time = new Date()) { let year = time.getFullYear(); let month = time.getMonth() + 1 > 9 ? time.getMonth() + 1 : "0" + (time.getMonth( 阅读全文

posted @ 2024-09-10 09:58 芮艺 阅读(22) 评论(0) 推荐(0)

获取rem像素转换比例 flag为true返回数字

摘要: // 获取rem像素转换比例 flag为true返回数字 export function getRem(px, flag) { px = (px || 0) + '' if (!(px.indexOf('%') !== -1 || px.indexOf('rem') !== -1)) { px = 阅读全文

posted @ 2024-09-10 09:22 芮艺 阅读(8) 评论(0) 推荐(0)

2024年9月4日 #

十六进制转RGB ---颜色-color

摘要: // 十六进制转RGB function hexToRgb(hex: string) { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? [ parseInt(result[1 阅读全文

posted @ 2024-09-04 17:48 芮艺 阅读(107) 评论(0) 推荐(0)

获取浏览器窗口大小

摘要: function getHeight(){ let height = document.documentElement.clientHeight || document.body.clientHeight || window.innerHeight; } onMounted(()=>{ const 阅读全文

posted @ 2024-09-04 17:28 芮艺 阅读(8) 评论(0) 推荐(0)

将一个时间段进行分割为每一天

摘要: function splitIntoDays(start ,end){ let days = []; let currentDay = []; while(currentDay <= end){ days.push(new Date(currentDay)); currentDay.setDate( 阅读全文

posted @ 2024-09-04 17:18 芮艺 阅读(18) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页