惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

N
Netflix TechBlog - Medium
博客园 - 聂微东
M
MIT News - Artificial intelligence
The Hacker News
The Hacker News
AI
AI
Hacker News: Ask HN
Hacker News: Ask HN
Cloudbric
Cloudbric
GbyAI
GbyAI
B
Blog RSS Feed
S
Secure Thoughts
O
OpenAI News
S
Schneier on Security
Latest news
Latest news
C
Check Point Blog
Know Your Adversary
Know Your Adversary
T
Tenable Blog
J
Java Code Geeks
The Cloudflare Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
WordPress大学
WordPress大学
P
Proofpoint News Feed
雷峰网
雷峰网
Engineering at Meta
Engineering at Meta
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
H
Hacker News: Front Page
www.infosecurity-magazine.com
www.infosecurity-magazine.com
美团技术团队
博客园 - 司徒正美
Security Latest
Security Latest
Forbes - Security
Forbes - Security
W
WeLiveSecurity
Webroot Blog
Webroot Blog
Last Week in AI
Last Week in AI
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
月光博客
月光博客
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Help Net Security
Help Net Security
H
Help Net Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
U
Unit 42
V2EX - 技术
V2EX - 技术
阮一峰的网络日志
阮一峰的网络日志
SecWiki News
SecWiki News
T
Troy Hunt's Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com

博客园 - 鼓舞飞扬

点表格,某一列出现报错。 qiankun使用关键代码 tinymce富文本编辑器使用 取消上次ajax 在vue项目中取消axios请求(单个和全局) JavaScript中的export、export default、exports和module.exports(export、export default、exports使用详细) 前端经典面试题 白屏优化 全网首发黑马程序员鸿蒙 HarmonyOS NEXT星河版零基础入门到实战,零基础也能快速入门鸿蒙开发教程 vue 图片资源应该如何存放并引入(public、assets)? mapbox聚合使用自定义图标 Mapbox添加多个不同的点图标 mapbox gl 标注无法显示 报错 Error {message: ‘Unimplemented type: 4‘} mapbox加载图片类型图标 mapbox大数据展示 The engine “node“ is incompatible with this module.解决方法 配置镜像 【NPM报错】Node Sass does not yet support your current environment Turf.js简介
自定义树形模糊搜索
鼓舞飞扬 · 2024-08-13 · via 博客园 - 鼓舞飞扬

自定义树形模糊搜索

 1 export const mapTree = (arr, value) => {
 2   let newarr = [];
 3   arr.forEach(element => {
 4     if (element.label.indexOf(value) > -1) {
 5       // 判断条件
 6       newarr.push(element);
 7     } else {
 8       if (element.children && element.children.length > 0) {
 9         let redata = mapTree(element.children, value);
10         if (redata && redata.length > 0) {
11           let obj = {
12             ...element,
13             children: redata
14           };
15           newarr.push(obj);
16         }
17       }
18     }
19   });
20   return newarr;
21 };

posted @ 2024-08-13 14:59  鼓舞飞扬  阅读(32)  评论(0)    收藏  举报