随笔分类 -  javascript

摘要:function get1DArray(arr1:any){ var arr2 = arr1.reduce(function (a:any, b:any) { return a.concat(b) }); return arr2; } get1DArray(dataForm.peiyangminmi 阅读全文
posted @ 2023-03-22 15:17 南瓜壳 阅读(18) 评论(0) 推荐(0) 编辑
摘要:function changeArrNum(arr:any,num:number){ let newCardList:any = []; for (var i = 0; i < arr.length; i += num) { newCardList.push(arr.slice(i, i + num 阅读全文
posted @ 2023-03-22 15:15 南瓜壳 阅读(124) 评论(0) 推荐(0) 编辑
摘要:newArr.filter((item) => !arr.includes(item)) 阅读全文
posted @ 2022-06-01 16:47 南瓜壳 阅读(112) 评论(0) 推荐(0) 编辑
摘要:function formatSeconds(value) { var theTime = parseInt(value); // 秒 var theTime1 = 0; // 分 var theTime2 = 0; // 小时 // alert(theTime); if (theTime > 60 阅读全文
posted @ 2022-05-31 16:21 南瓜壳 阅读(132) 评论(0) 推荐(0) 编辑
摘要:import axios from 'axios'; import qs from 'qs'; import { Message} from '@alifd/next'; //默认地址 const request = axios.create({ timeout: 100000, baseURL:' 阅读全文
posted @ 2022-05-10 19:23 南瓜壳 阅读(50) 评论(0) 推荐(0) 编辑
摘要://重新向新的数组里面塞值 function renderListValue(arr, newarr) { for (let i = 0; i < arr.length; i++) { let obj = {} if (arr[i].leaf == true) { obj.budgetAmount 阅读全文
posted @ 2021-07-09 10:06 南瓜壳 阅读(74) 评论(0) 推荐(0) 编辑
摘要:// 深拷贝函数 const _clone = (data) => { if (!data || !(data instanceof Object) || typeof data == 'function') { return data || undefined } let constructor 阅读全文
posted @ 2021-07-09 09:58 南瓜壳 阅读(550) 评论(0) 推荐(0) 编辑
摘要:// 如果time2大于time1 返回true 否则 返回false function compareTime(time1,time2) { if(time_to_sec(time2)-time_to_sec(time1)>0){ return true; } return false; } // 阅读全文
posted @ 2021-07-08 15:45 南瓜壳 阅读(2493) 评论(0) 推荐(0) 编辑
摘要:export function TimeCompare(date1,date2){ var oDate1 = new Date(date1); var oDate2 = new Date(date2); if(oDate1.getTime() > oDate2.getTime()){ return 阅读全文
posted @ 2021-07-08 15:16 南瓜壳 阅读(418) 评论(0) 推荐(0) 编辑
摘要:文档链接 :https://blog.csdn.net/weixin_43487066/article/details/105409599 安装 npm install better-scroll -S 组件 scroll.vue <template> <div ref="wrapper"> <di 阅读全文
posted @ 2021-07-01 16:17 南瓜壳 阅读(55) 评论(0) 推荐(0) 编辑
摘要:function clearNoNum(value) { //先把非数字的都替换掉,除了数字和. value = value.replace(/[^\d.]/g, '') //保证只有出现一个.而没有多个. value = value.replace(/\.{2,}/g, '.') //必须保证第一 阅读全文
posted @ 2021-06-22 20:30 南瓜壳 阅读(199) 评论(0) 推荐(0) 编辑
摘要:var str1 = str.replace(/\\/g,"/"); 阅读全文
posted @ 2021-02-20 10:05 南瓜壳 阅读(638) 评论(0) 推荐(0) 编辑
摘要:newArr[2].substring(2,5).replace(/\b(0+)/gi,"") 阅读全文
posted @ 2021-01-20 10:36 南瓜壳 阅读(737) 评论(0) 推荐(0) 编辑
摘要:数组:arr:[ {"aa":[{"num":"23"}]}, {"bb":[{"num":"43"}]}, {"cc":[{"num":"42"}]}, ] arr.forEach((value,i)=>{ //数组循环 for(var pl in value){ //数组对象遍历 console 阅读全文
posted @ 2021-01-14 13:39 南瓜壳 阅读(12338) 评论(0) 推荐(0) 编辑
摘要://定义一个比较器 compare(propertyName) { return function(object1, object2) { var value1 = object1[propertyName] var value2 = object2[propertyName] if (value2 阅读全文
posted @ 2020-12-23 16:24 南瓜壳 阅读(220) 评论(0) 推荐(0) 编辑
摘要:1:var json = JSON.parse(str);//注意:属性和属性值都用双引号引住(使用单引号来套双引号,如果反过来写报错) 2:var json = eval("(" + str + ")"); 3:var json = (new Function("return " + str))( 阅读全文
posted @ 2020-10-20 15:50 南瓜壳 阅读(2020) 评论(0) 推荐(0) 编辑
摘要:var arr = ["1122","2233","3344"] var newArr = [ {id:"1122",name:"Wang"}, {id:"11",name:"Zhang"}, {id:"2233",name:"Shen"}, {id:"3344",name:"EER"}, {id: 阅读全文
posted @ 2020-06-29 16:48 南瓜壳 阅读(1845) 评论(0) 推荐(0) 编辑
摘要:window.onload = function(){ getRem(750,100) }; window.onresize = function(){ getRem(750,100) }; function getRem(pwidth,prem){ var html = document.getE 阅读全文
posted @ 2020-04-07 11:22 南瓜壳 阅读(133) 评论(0) 推荐(0) 编辑
摘要:var newArray = [{ name: "aaa", value: 0 }, { name: "ddd", value: 3 }, { name: "bbb", value: 1 }, { name: "eee", value: 4 }, { name: "ccc", value: 2 }] 阅读全文
posted @ 2020-03-16 17:44 南瓜壳 阅读(940) 评论(0) 推荐(0) 编辑