摘要: 结果:设置文字不换行,溢出后隐藏,截断显示省略符 .ellipsis { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } 结果:-webkit-line-clamp 可以把块容器中的内容限制为指定的行数为截断显示省略 阅读全文
posted @ 2022-05-26 23:00 前端搬运工bug 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} formater 时间格式 * @param {*} time 自定时间,默认当前时间 * @returns */ const dateFormater = (formater, time) => { let date = time ? new Date 阅读全文
posted @ 2022-05-26 22:54 前端搬运工bug 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 结果: const nowTime = () => { const now = new Date(); const year = now.getFullYear(); const month = now.getMonth(); const date = now.getDate() >= 10 ? n 阅读全文
posted @ 2022-05-26 22:49 前端搬运工bug 阅读(26) 评论(0) 推荐(0) 编辑
摘要: const getExplorerInfo = () => { let t = navigator.userAgent.toLowerCase(); return 0 <= t.indexOf("msie") ? { //ie < 11 type: "IE", version: Number(t.m 阅读全文
posted @ 2022-05-26 22:45 前端搬运工bug 阅读(57) 评论(0) 推荐(0) 编辑
摘要: const broswer = () => { const ua = navigator.userAgent.toLowerCase(); if (ua.match(/MicroMessenger/i) == "micromessenger") { return "weixin"; } else i 阅读全文
posted @ 2022-05-26 22:44 前端搬运工bug 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} value 身份证 * @returns */ const checkCardNo = (value) => { let reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/; return reg.test( 阅读全文
posted @ 2022-05-26 22:41 前端搬运工bug 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} value 数字 * @returns */ const intToChinese = (value) => { const str = String(value); const len = str.length-1; const idxs = ['', 阅读全文
posted @ 2022-05-26 22:37 前端搬运工bug 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} n 数字 * @returns */ const digitUppercase = (n) => { const fraction = ['角', '分']; const digit = [ '零', '壹', '贰', '叁', '肆', '伍', ' 阅读全文
posted @ 2022-05-26 22:35 前端搬运工bug 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} tel 电话号码 * @returns */ const telFormat = (tel) => { tel = String(tel); return tel.substr(0,3) + "****" + tel.substr(7); }; cons 阅读全文
posted @ 2022-05-26 22:28 前端搬运工bug 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} str 字符串 * @returns */ const fistLetterUpper = (str) => { return str.charAt(0).toUpperCase() + str.slice(1); }; console.log(fist 阅读全文
posted @ 2022-05-26 22:26 前端搬运工bug 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 结果: /** * * @param {*} len 需要生成的长度 * @returns */ const randomString = (len) => { let chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz123456789'; let 阅读全文
posted @ 2022-05-26 22:24 前端搬运工bug 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 结果: const people = [ { name: 'Alice', age: 21 }, { name: 'Max', age: 20 }, { name: 'Jane', age: 20 } ]; /** * * @param {*} objectArray 数组 * @param {*} 阅读全文
posted @ 2022-05-26 22:05 前端搬运工bug 阅读(21) 评论(0) 推荐(0) 编辑