07 2023 档案
摘要:从头到尾搜索数组:findLast() 、findLastIndex() 从末尾开始搜索
阅读全文
摘要:import Vue from "vue" let startTestModel = true //开启测试模式 const BASE_URL = '' // 接口域名 const IMG_URL = '' // 图片域名 // 声明 测试模式 console.log("%c".concat("开发
阅读全文
摘要:/** * Created by zrs */ import Vue from 'vue' /** * json拼接为字符串 * @param json * @returns {string} */ export function qs (json) { let str = '' for (let
阅读全文
摘要:const http = require('http'); const hostname = '127.0.0.1'; const port = 3000; const server = http.createServer((req, res) => { res.statusCode = 200;
阅读全文
摘要:function parseTree(tree) { const res = [] array.forEach(item => { // 如果item中有children,则递归调用 item.parentId = item.parentId || 0; let id = item.id let c
阅读全文
摘要:/** * 提取对象中的指定的属性,返回一个新对象 */ function pickProps(obj, props) { if (typeof obj !== 'object') { return obj; } const newObj = {}; props.forEach((prop) =>
阅读全文
摘要:/** * 提取若干数组中指定字段组合成一个新数组 */ function extractProps(arr, prop) { return arr.map((item) => item[prop]); }
阅读全文
摘要:function deepClone(obj) { if (obj null) return null; if (typeof obj !== 'object') return obj; if (obj instanceof Date) { let date = new Date(); date.s
阅读全文
摘要:// 把若干数组按指定的字段名进行分组 function groupBy(list, propName) { return list.reduce((acc, item) => { const key = item[propName]; if (!acc[key]) { acc[key] = [];
阅读全文
摘要:// 身份证号function isIdCard(str) { return /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/.test(str); } //
阅读全文
摘要:// 可被用来过渡的background-color background-position border-color border-width border-spacing bottom color font-size font-weight height left letter-spacing
阅读全文
摘要:animation-name: myanimation; // 动画名字,指定关键帧的名字。 animation-duration: 4s; // 动画持续时间,间接控制速率,越长越慢! animation-iteration-count: infinite; // 重复次数,可以填数字也可以填in
阅读全文
摘要:HTML部分 <body> <div class="box"></div> </body> css部分 // 设置背景颜色 body { background: #333; } .box { background: #fff; // 设置显眼的颜色 width: 200px; // 固定宽,为了看的
阅读全文
摘要:// 单行显示.oneline { overflow: hidden; word-break: break-all; text-overflow: ellipsis; -webkit-box-orient: horizontal; -webkit-line-clamp: 1; line-clamp:
阅读全文
摘要:/** * 获取地图上两点间距离。单位:米 * @param {lat1} 第一个点的纬度 * @param {lon1} 第一个点的经度 * @param {lat2} 第二个点的纬度 * @param {lon2} 第二个点的经度 * @author 人参 */ export function
阅读全文
摘要:/** * 节流 * 在给定时间内只有第一次的操作会返回结果 * 结合了防抖的思路:在delay时间内生成定时器,一旦到了delay的时间就返回结果 * 当用户只点击了一次的时候,在delay时间后得到结果 * 当用户点击了多次的时候,在delay时间后得到第一次的结果,其余的被节流阀忽视掉 * @
阅读全文