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


边栏推荐
- Thinkphp6 integrated JWT method and detailed explanation of generation, removal and destruction
- 我管你什么okr还是kpi,PPT轻松交给你
- 基于.NetCore开发博客项目 StarBlog - (14) 实现主题切换功能
- “疫”起坚守 保障数据中台服务“不打烊”
- Some other configurations on Huawei's spanning tree
- 关于 uintptr_t和intptr_t 类型
- Gnupg website
- Analysis and solution of lazyinitializationexception
- Summary of common tools and technical points of PMP examination
- 功能:求5行5列矩阵的主、副对角线上元素之和。注意, 两条对角线相交的元素只加一次。例如:主函数中给出的矩阵的两条对角线的和为45。
猜你喜欢
![[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)

Meta metauniverse female safety problems occur frequently, how to solve the relevant problems in the metauniverse?

What is the GPM scheduler for go?

In the process of seeking human intelligent AI, meta bet on self supervised learning

Characteristics of ginger

How to set the response description information when the response parameter in swagger is Boolean or integer
![[dynamic programming] leetcode 53: maximum subarray sum](/img/f0/80357f9ffc556f3ed4d3aa0901bb1d.jpg)
[dynamic programming] leetcode 53: maximum subarray sum

MySQL deadly serial question 2 -- are you familiar with MySQL index?
![[error record] configure NDK header file path in Visual Studio](/img/9f/89f68c037dcf68a31a2de064dd8471.jpg)
[error record] configure NDK header file path in Visual Studio

A-Frame虚拟现实开发入门
随机推荐
C import Xls data method summary V (complete code)
Cesiumjs 2022^ source code interpretation [8] - resource encapsulation and multithreading
Function: store the strings entered in the main function in reverse order. For example, if you input the string "ABCDEFG", you should output "gfedcba".
PMP 考试常见工具与技术点总结
Stringutils and collectionutils
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
Sequence list and linked list
Huawei BFD and NQA
The FISCO bcos console calls the contract and reports an error does not exist
[prefix and notes] prefix and introduction and use
Regular expression of shell script value
Huawei rip and BFD linkage
7.1 学习内容
Force deduction solution summary 1189- maximum number of "balloons"
The difference between fetchtype lazy and eagle in JPA
leetcode 121 Best Time to Buy and Sell Stock 买卖股票的最佳时机(简单)
CesiumJS 2022^ 源码解读[8] - 资源封装与多线程
Decompile and modify the non source exe or DLL with dnspy
老姜的特点
Characteristics of ginger