深入迭代JSON对象React.js-redux,

时间:2019-01-24 08:05:00

标签: reactjs redux react-redux react-router-redux

我在Redux中存储了一个json对象,我必须显示所有标题{As LINKS},单击标题时它会显示其“ section:[....]”(按TITLE {LINKS})并进行迭代直到JSONOBJECT.section.type===menu为止,并显示该部分的所有标题。如果'section.type ===“ Vid”',则仅是Anchor标签。

AND AND AND  “”“点击返回按钮后,就可以像上一页一样加载previousState / props。”“”“使用REDUX。

jsonObject的快照。 https://i.stack.imgur.com/HbYru.png

说明: 我已经在名为“ DASHBOARD.js”的组件上加载了根级别部分,并单击了要在同一“ DASHBOARD.js”上加载subSections的任何标题,然后单击“ BACK”按钮加载了先前的superSection。

{ "id":"", "section":[ { "id":"", "section":[{ "id":"", "section":[{ "id":"", "section":[{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" }], "title":"", "type":"menu" }], "title":"", "type":"menu" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" }], "title":"", "type":"menu" },{ "id":"", "section":[{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" }], "title":"", "type":"menu" },{ "id":"", "section":[{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" }], "title":"", "type":"menu" },{ "id":"", "section":[{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" },{ "id":"", "section":[], "title":"", "type":"Vid" }], "title":"", "type":"menu" } ], "title":"", "type":"menu" }

看起来像什么项目的示例视图:[1] https://i.stack.imgur.com/M3f5f.png [2] https://i.stack.imgur.com/vnb00.png [3] https://i.stack.imgur.com/705ni.png

首先,我单击了任何导航项 (平角部分|| Mrss Locked SectionZZ || Mrss Free Section || Sim Live free ..) 然后,将像给定图像一样加载其contentTitle [image:1],所有标题均为“”。然后,单击该链接,将加载“” childContentTitle [image:2]“”,然后单击该“ “ childContentTitle”会先加载“” grandchildContentTitle“”,然后再加载“ grandgrandchild [image:3]”,依此类推。所有这些都将在同一名为Dashboard的reactComponent上重新渲染,直到JSON.type!==“ vid”。

0 个答案:

没有答案