当前位置: 首页 > news >正文

网站建设服务方案seo上海优化

网站建设服务方案,seo上海优化,中文网页模板大全,濮阳百度推广原文链接#xff1a;如何将路径字符串数组(string[])转成树结构(treeNode[])#xff1f; 需求 这里的UI使用的是Element-Plus。 将一个路径字符串数组#xff08;当然也可能是其他目标字符串数组#xff09;#xff0c;渲染成树。 /*source:/a/b/c/d/e/a/b/e/f/g/a/b/h/a… 原文链接如何将路径字符串数组(string[])转成树结构(treeNode[]) 需求 这里的UI使用的是Element-Plus。 将一个路径字符串数组当然也可能是其他目标字符串数组渲染成树。 /*source:/a/b/c/d/e/a/b/e/f/g/a/b/h/a/i/j/a/i/kwhat I need:a/   \b     i/|\   / \c e h j   k| |d f| |e g */这里模拟了待转化的字符串数组如下 let TargetKeyLists [D:\\$RECYCLE.BIN\\S-1-5-21-2980625316-768050560-104202119-1001\\$I0KVI2C.css,D:\\$RECYCLE.BIN\\S-1-5-21-2980625316-768050560-104202119-1001\\$I61JY0M.php,D:\\$RECYCLE.BIN\\S-1-5-21-2980625316-768050560-104202119-1001\\$I8IC15E.html,D:\\$RECYCLE.BIN\\S-1-5-21-2980625316-768050560-104202119-1001\\$I9UTNI9.ico,D:\\Program Files\\Sandboxie,D:\\fbs\\xampp-windows-x64-8.2.0-0-VS16-installer.exe,D:\\fcstor\\.svn,D:\\xampp\\MercuryMail,D:\\xampp\\anonymous,D:\\xampp\\apache,C:\\$Recycle.Bin\\S-1-5-18,C:\\$Recycle.Bin\\S-1-5-21-2980625316-768050560-104202119-1001,C:\\$Recycle.Bin\\S-1-5-21-2980625316-768050560-104202119-500,C:\\BOOTNXT, ]转化后的目标结构如下 [{label: D:,children: [{label: $RECYCLE.BIN,children: [{label: S-1-5-21-2980625316-768050560-104202119-1001,children: [{label: $I0KVI2C.css,children: []},{label: $I61JY0M.php,children: []},{label: $I8IC15E.html,children: []},{label: $I9UTNI9.ico,children: []}]}]},{label: Program Files,children: [{label: Sandboxie,children: []}]},{label: fbs,children: [{label: xampp-windows-x64-8.2.0-0-VS16-installer.exe,children: []}]},{label: fcstor,children: [{label: .svn,children: []}]},{label: xampp,children: [{label: MercuryMail,children: []},{label: anonymous,children: []},{label: apache,children: []}]}]},{label: C:,children: [{label: $Recycle.Bin,children: [{label: S-1-5-18,children: []},{label: S-1-5-21-2980625316-768050560-104202119-1001,children: []},{label: S-1-5-21-2980625316-768050560-104202119-500,children: []}]},{label: BOOTNXT,children: []}]} ]步骤 1.在utils文件夹下新建index.ts文件。 interface TreeNode {label: stringchildren: TreeNode[] }// 循环构建子节点 const buildChildrenNode (children: TreeNode[], nodeArray: string[]) {for (let i in nodeArray) {let _i: number Number(i)let node: TreeNode {label: nodeArray[_i],children: []}if (_i ! nodeArray.length) {node.children []}if (children.length 0) {children.push(node)}let isExist falsefor (let j in children) {if (children[j].label node.label) {if (_i ! nodeArray.length - 1 !children[j].children) {children[j].children []}children _i nodeArray.length - 1 ? children : children[j].childrenisExist truebreak}}if (!isExist) {children.push(node)if (_i ! nodeArray.length - 1 !children[children.length - 1].children) {children[children.length - 1].children []}children _i nodeArray.length - 1 ? children : children[children.length - 1].children}} } /*** description: string[] - treeNode[]* param {string} list 资源路径数组* param {string} clientLabel 是否需要在最外面还要套一层exam所属客户端* return { treeNode[] }*/ export const array2Tree (list: string[], clientLabel?: string) {let targetList: TreeNode[] []list.map(item {let label itemlet nodeArray: string[] label.split(\\).filter(str str ! )// 递归let children: TreeNode[] targetList// 构建根节点if (children.length 0) {let root: TreeNode {label: nodeArray[0],children: []}if (nodeArray.length 1) {root.children []}children.push(root)buildChildrenNode(children, nodeArray)} else {buildChildrenNode(children, nodeArray)}})if (!clientLabel) {return targetList} else {const newArr [{label: clientLabel,children: targetList}]return newArr} }2.在目标页面中引入并调用array2Tree方法即可。 templateel-tree :dataconfirmTreeList default-expand-all / /templateimport { array2Tree } from /utils/indexlet confirmTreeList: TreeNode[] []confirmTreeList array2Tree(TargetKeyLists) 3.效果如下 这里说明一下array2Tree()方法中的clientLabel参数其实可要可不要也可继续扩展根据自身业务而定。 比如我想最后实现的效果如下图所示 所以在第2步中传入clientLabel即可 confirmTreeList array2Tree(TargetKeyLists,test(192.168.0.213))
http://www.w-s-a.com/news/866212/

相关文章:

  • 猎头可以做单的网站企业网站建设
  • 建小程序需要网站吗在putty上怎样安装wordpress
  • 天津智能网站建设找哪家WordPress相册插件pro
  • 电脑网站页面怎么调大小济宁网站建设软件开发
  • 亿玛酷网站建设广州增城区最新消息
  • 企业网站视频栏目建设方案中企动力网站模板
  • 网站页面策划国外注册域名的网站
  • 百中搜如何做网站排名网站维护一年一般多少钱
  • 镇江地区做网站的公司wordpress说说加分类
  • 深圳高端网站设计免费的关键词优化软件
  • 视频网站公司沈阳网站建设服务
  • 网站全屏代码做网站必须用对方服务器
  • 网站速度慢wordpressssl正式申请后wordpress
  • 那个网站做玉石最专业西瓜创客少儿编程加盟
  • 备案时的网站建设方案书免费软件库
  • 惠州外贸网站建设网站模板 兼容ie8
  • 南京淄博网站建设方案php网站开发实训感想
  • 网站设计的含义只做恐怖片的网站
  • 网站改版方案ppt室内装修公司简介
  • 做色网站wordpress twenty ten
  • 马鞍山建设工程监督站建管处网站免费的海报模板网站
  • 类似百度的网站移动端的网站怎么做的
  • 网站开发需要什么文凭网站分析的优劣势
  • 海尔网站建设不足之处山东网站营销
  • 楚雄 网站建设广告设计一般人能学吗
  • 热搜榜排名前十山东seo多少钱
  • 衡水哪有建网站的吗企业信息系统英文
  • 有模板怎么建站wordpress媒体库图片路径
  • 怎么做网站h汉狮企业网站营销的实现方式
  • 新津县建设局网站怎么做区块链网站