12 2021 档案
摘要:/** * 数组转字符串 */ const arr = [1, 3, 5, 7, 9]; // 方法1 const str1 = arr.toString(); // str1: 1,3,5,7,9 // 方法2 const str2 = arr.join('**'); // str2: 1**3*
阅读全文
摘要:/** * 数组删除指定项 * item: 要删除的项 * array:要执行删除项的数组 * code: 数组项的唯一字段 */ arrayRemoveItem(item, array, code?: string) { const idx = array.findIndex(ite => { r
阅读全文
摘要:/** * 获取url参数 * name: 可选项,获取某参数,如果不传参将返回参数对象 */ getUrlParams(name?) { const url = window.location.href; const paramList = url.split('?')[1]?.split('&'
阅读全文