07 2022 档案

摘要:1 import React, {useEffect, useState} from 'react'; 2 import { connect } from 'dva'; 3 import styles from './IndexPage.css'; 4 5 let timer; 6 function 阅读全文
posted @ 2022-07-20 17:07 不知码 阅读(180) 评论(0) 推荐(0)
摘要:1.防抖 function debounce(fun, time) { let timers; return function(){ clearTimeout(timers); let arg = arguments; timers = setTimeout( () => { fun.apply(t 阅读全文
posted @ 2022-07-05 19:23 不知码 阅读(19) 评论(0) 推荐(0)
摘要:function arrTrans(num, arr) { // 一维数组转换为二维数组 const iconsArr = []; // 声明数组 arr.forEach((item, index) => { const page = Math.floor(index / num); // 计算该元 阅读全文
posted @ 2022-07-05 19:06 不知码 阅读(64) 评论(0) 推荐(0)
摘要:1. 对象数组去重 let arr = [ {name: 'mom', id:1}, {name: 'timo', id:2}, {name: 'mom', id:1}, {name: 'timo', id:2}, ] let obj={}; const newarry = arr.reduce( 阅读全文
posted @ 2022-07-05 18:19 不知码 阅读(48) 评论(0) 推荐(0)