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

推荐订阅源

云风的 BLOG
云风的 BLOG
Hacker News: Ask HN
Hacker News: Ask HN
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
The Exploit Database - CXSecurity.com
The Hacker News
The Hacker News
Security Latest
Security Latest
Attack and Defense Labs
Attack and Defense Labs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Scott Helme
Scott Helme
H
Heimdal Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
WordPress大学
WordPress大学
雷峰网
雷峰网
L
LangChain Blog
Y
Y Combinator Blog
I
Intezer
V
Vulnerabilities – Threatpost
Apple Machine Learning Research
Apple Machine Learning Research
The Last Watchdog
The Last Watchdog
Simon Willison's Weblog
Simon Willison's Weblog
W
WeLiveSecurity
P
Privacy International News Feed
V
Visual Studio Blog
T
The Blog of Author Tim Ferriss
A
About on SuperTechFans
AI
AI
博客园 - Franky
Hacker News - Newest:
Hacker News - Newest: "LLM"
Martin Fowler
Martin Fowler
K
Kaspersky official blog
U
Unit 42
S
Schneier on Security
Webroot Blog
Webroot Blog
Know Your Adversary
Know Your Adversary
T
Tor Project blog
aimingoo的专栏
aimingoo的专栏
Engineering at Meta
Engineering at Meta
G
GRAHAM CLULEY
美团技术团队
TaoSecurity Blog
TaoSecurity Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Google DeepMind News
Google DeepMind News
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
人人都是产品经理
人人都是产品经理
P
Proofpoint News Feed
爱范儿
爱范儿
F
Fortinet All Blogs
有赞技术团队
有赞技术团队

博客园 - 鼓舞飞扬

点表格,某一列出现报错。 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)    收藏  举报