当前位置:网站首页>ES6 deletes an attribute in all array objects through map, deconstruction and extension operators
ES6 deletes an attribute in all array objects through map, deconstruction and extension operators
2022-07-04 01:18:00 【Programmer base camp】
First of all, demand
There are two drop-down boxes in a form , All access the same interface to get the tree structure List Data is dynamically bound to their respective drop-down boxes , The difference lies in A The drop-down box shows only the root node ,B The drop-down box displays all the data of the tree structure .
For performance reasons , The front end must only send one ajax request , The back end only writes one acquisition TreeList Interface of structure , It is used to meet the dynamic assignment of two drop-down boxes .
Pictured : The left figure shows the root node item , The right figure shows all tree structure items

Paste the returned data structure

Ideas : From the perspective of data structure, it contains all the root node and child node data treeList Array objects .B The drop-down box can be assigned unchanged ,A The drop-down box needs to put children Attribute is deleted .
Here are a few knowledge points : Deep copy ,map、 Deconstruction and extension operators adopt ES6 The syntax of is elegant to delete the attributes in the array
Post code directly :

Finally, the root node data printed is compared as follows :


边栏推荐
- MySQL - use of aggregate functions and group by groups
- It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
- A-Frame虚拟现实开发入门
- Introduction to unity shader essentials reading notes Chapter III unity shader Foundation
- What is the GPM scheduler for go?
- String hash, find the string hash value after deleting any character, double hash
- Introduction to thread pool
- 机器学习基础:用 Lasso 做特征选择
- 技术实践|线上故障分析及解决方法(上)
- Introduction to A-frame virtual reality development
猜你喜欢

A-Frame虚拟现实开发入门

It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction

Future源码一观-JUC系列

Introduction to A-frame virtual reality development

Regular expression of shell script value

A dichotomy of Valentine's Day

技术实践|线上故障分析及解决方法(上)
![[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)](/img/44/aa4963d07d046deb2bc76eb59f8ff7.jpg)
[error record] configure NDK header file path in Visual Studio (three header file paths of NDK | ASM header file path selection related to CPU architecture)

How to delete MySQL components using xshell7?

Beijing invites reporters and media
随机推荐
Msp32c3 board connection MSSQL method
求esp32C3板子连接mssql方法
From functools import reduce -- see the use of reduce function from typical examples
我管你什么okr还是kpi,PPT轻松交给你
Severity code description the project file line prohibits the display of status error c4996 fopen ('fscanf ', StrCmp): this function or variable may be unsafe The most comprehensive solution
A little understanding of GSLB (global server load balance) technology
【.NET+MQTT】. Net6 environment to achieve mqtt communication, as well as bilateral message subscription and publishing code demonstration of server and client
8. Go implementation of string conversion integer (ATOI) and leetcode
The force deduction method summarizes the single elements in the 540 ordered array
How to use AHAS to ensure the stability of Web services?
Summary of common tools and technical points of PMP examination
Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction
MySQL introduction - functions (various function statistics, exercises, details, tables)
Stringutils and collectionutils
Conditional test, if, case conditional test statements of shell script
Weekly open source project recommendation plan
1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
功能:求出菲波那契数列的前一项与后一项之比的极限的 近似值。例如:当误差为0.0001时,函数值为0.618056。
Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?
C import Xls data method summary IV (upload file de duplication and database data De duplication)