当前位置:网站首页>js根据名字将数组对象中名字相同的项组成一个相同的数组
js根据名字将数组对象中名字相同的项组成一个相同的数组
2022-04-23 05:53:00 【Front 小思】

需求:今天遇到一个的是当前定位在广州,根据传广州过去获取会的的所有区的门店数据!设计稿要求:根据所在的区来分类某个区有哪些门店!但是后端就返回一个数组里面有所有的门店!

设计稿:

let tempArr = [];
for (let i = 0; i < that.storeList.length; i++) {
if (tempArr.indexOf(that.storeList[i].area_name) === -1) {
that.afterData.push({
name: that.storeList[i].area_name,
origin: [that.storeList[i]]
});
tempArr.push(that.storeList[i].area_name);
} else {
for (let j = 0; j < that.afterData.length; j++) {
if (that.afterData[j].name == that.storeList[i].area_name) {
that.afterData[j].origin.push(that.storeList[i]);
break;
}
}
}
}
console.log("88888888888888", that.afterData);

搞定!回家吃饭去!!!

版权声明
本文为[Front 小思]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45788691/article/details/122144065
边栏推荐
- PHP junior programmers, take orders and earn extra money
- Incremental update of client software
- C51/C52 特殊功能寄存器表
- Notes on advanced points of C language 4
- Informatics one book pass - small ball
- ES6
- Palindromic Primes
- [UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer
- C语言实用小技巧合集(持续更新)
- [ThreadX] h743 + ThreadX + Filex migration record
猜你喜欢
![[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)](/img/98/becd691d3d46f74f7666f5cb323eaf.png)
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
![[UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit](/img/22/c501c79176a93345dc72ff150c53c3.png)
[UDS unified diagnostic service] IV. typical diagnostic service (2) - data transmission function unit

JS中 t, _ => 的解析

对象的动态建立和释放,赋值和复制

Installation of GCC, G + +, GDB
![[UDS] unified diagnostic service (UDS)](/img/ed/8c16e4f1136fff95a829be410cab11.png)
[UDS] unified diagnostic service (UDS)

HDU-Tunnel Warfare

【UDS统一诊断服务】一、诊断概述(1)— 诊断概述

For() loop parameter call order

copy constructor
随机推荐
20220222回归职场
【UDS统一诊断服务】一、诊断概述(1)— 诊断概述
cuda工程更换环境(电脑)后遇到的一系列编译问题
信息学一本通-小球
Generate shortcut
Notes on advanced points of C language 2
文件查看命令和用户管理命令
[learn] HF net training
For() loop parameter call order
C语言进阶要点笔记2
Initialization of classes and objects (constructors and destructors)
VHDL 有限状态机(FSM) 代码示例
OpenCV使用 GenericIndex 进行 KNN 搜索
_findnext 报错
copy constructor
深蓝学院激光slam 理论与实践 第三章激光雷达去畸变 作业习题
ARM常用汇编指令
Protection of shared data
ROS包nmea_navsat_driver读取GPS、北斗定位信息笔记
基于TensorFlow的线性回归实例