Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
546 views
in Technique[技术] by (71.8m points)

vue+饿了么中input关键字筛选多层级复杂数组,返回关键字匹配的数据,并保留层级结构

题目描述

在input中输入关键字后,在不固定层级的数组中,遍历一遍数组,然后返回与关键字相匹配的数据筛选出来,还要保留数组的层级结构,不影响el-table的展示

题目来源及自己的思路

请大佬指教

相关代码

粘贴代码文本(请勿用截图)
{

"content": "新增ACL",
"tips": {
  "item": [
    {
      "id": 3,
      "content": "已配置",
      "up": 3
    }
  ],
  "comment": [
    {
      "id": 1,
      "name": "小芳",
      "content": "重排序失败,写变更时避开10、20等序号。重排序失败,写变更时避开10、20等序号.重排序失败,写变更时避开10、20等序号"
    },
    {
      "id": 2,
      "name": "近晗",
      "content": "ACL工具使用了这个方案。"
    }
  ]
},
"brand": "双汇",
"type": "NF40",
"relate_chg": [
  {
    "group": "网络组",
    "chg_count": 120,
    "chg_list": [
      {
        "chg_num": "CASIA200114007",
        "writer": "黄峰",
        "executer": "晓珊"
      },
      {
        "chg_num": "CDCCS200508050",
        "writer": "王六",
        "executer": "秦巴"
      }
    ]
  },
  {
    "group": "核心组",
    "chg_count": 4,
    "chg_list": [
      {
        "chg_num": "CASIA200114007",
        "writer": "张三",
        "executer": "李四"
      }
    ]
  }
],
"plan_tool": {
  "name": "ACOnline"
}

},
{

"content": "开端口",
"tips": {
  "item": [
    {
      "id": 1,
      "content": "如有时间范围要求,则先配置time-range",
      "up": 8
    },
    {
      "id": 2,
      "content": "为避免出现需要覆盖,实施前先进行重排序",
      "up": 5
    }
  ],
  "comment": [
    {
      "id": 1,
      "name": "何旧",
      "content": "重排序失败,要注意。"
    }
  ]
},
"brand": "科久",
"type": "IOS",
"relate_chg": [
  {
    "group": "技术组",
    "chg_count": 12,
    "chg_list": [
      {
        "chg_num": "CKFZX200415121",
        "writer": "王五",
        "executer": "赵六"
      },
      {
        "chg_num": "CQHFH200407004",
        "writer": "秦琦",
        "executer": "孙八"
      }
    ]
  },
  {
    "group": "网络开发组",
    "chg_count": 48,
    "chg_list": [
      {
        "chg_num": "CQHFH200407004",
        "writer": "张三",
        "executer": "李四"
      }
    ]
  }
],
"plan_tool": {
  "name": "ACLonline"
}

}

你期待的结果是什么?实际看到的错误信息又是什么?

例如:想要在input中输入"张三", 这个数据中的所有带"张三"这个字的数据都留下,展示在el-table中,其他的不用,请大佬指教


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...