当前位置:网站首页>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 :


边栏推荐
- “疫”起坚守 保障数据中台服务“不打烊”
- AI helps make new breakthroughs in art design plagiarism retrieval! Professor Liu Fang's team paper was employed by ACM mm, a multimedia top-level conference
- A malware detection method for checking PLC system using satisfiability modulus theoretical model
- HackTheBox-baby breaking grad
- Swagger2 quick start and use
- OS interrupt mechanism and interrupt handler
- 1-redis architecture design to use scenarios - four deployment and operation modes (Part 1)
- C import Xls data method summary V (complete code)
- 不得不会的Oracle数据库知识点(三)
- swagger中响应参数为Boolean或是integer如何设置响应描述信息
猜你喜欢

打印菱形图案

Hash table, string hash (special KMP)

Some other configurations on Huawei's spanning tree

Huawei rip and BFD linkage

What is regression testing? Talk about regression testing in the eyes of Ali Test Engineers

AI helps make new breakthroughs in art design plagiarism retrieval! Professor Liu Fang's team paper was employed by ACM mm, a multimedia top-level conference

How to delete MySQL components using xshell7?

String hash, find the string hash value after deleting any character, double hash
![[error record] configure NDK header file path in Visual Studio](/img/9f/89f68c037dcf68a31a2de064dd8471.jpg)
[error record] configure NDK header file path in Visual Studio

C import Xls data method summary II (save the uploaded file to the DataTable instance object)
随机推荐
It's OK to have hands-on 8 - project construction details 3-jenkins' parametric construction
[common error] UART cannot receive data error
Beijing invites reporters and media
12. Go implementation of integer to Roman numeral and leetcode
Software testers, how can you quickly improve your testing skills? Ten minutes to teach you
Release and visualization of related data
使用dnSpy对无源码EXE或DLL进行反编译并且修改
不得不会的Oracle数据库知识点(二)
A dichotomy of Valentine's Day
MySQL deadly serial question 2 -- are you familiar with MySQL index?
数据库表外键的设计
Network layer - routing
The culprit of unrestrained consumption -- Summary
7.1 学习内容
Weekly open source project recommendation plan
Leetcode 121 best time to buy and sell stock (simple)
What is the GPM scheduler for go?
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
C import Xls data method summary IV (upload file de duplication and database data De duplication)
C library function int fprintf (file *stream, const char *format,...) Send formatted output to stream