怎么用vue.js 在前端嵌套遍历这样的数据,可以像京东那样在首页显示商品层级分类的

[
{
"id": 1,
"name": "图书、音像、电子书刊",
"parentId": 0,
"isParent": true,
"sort": 1,
"node": [
{
"id": 2,
"name": "电子书刊",
"parentId": 1,
"isParent": true,
"sort": 1,
"node": [
{
"id": 3,
"name": "电子书",
"parentId": 2,
"isParent": false,
"sort": 1,
"node": null
},
{
"id": 4,
"name": "网络原创",
"parentId": 2,
"isParent": false,
"sort": 2,
"node": null
},
{
"id": 5,
"name": "数字杂志",
"parentId": 2,
"isParent": false,
"sort": 3,
"node": null
},
{
"id": 6,
"name": "多媒体图书",
"parentId": 2,
"isParent": false,
"sort": 4,
"node": null
}
]
},
{
"id": 7,
"name": "音像",
"parentId": 1,
"isParent": true,
"sort": 2,
"node": [
{
"id": 8,
"name": "音乐",
"parentId": 7,
"isParent": false,
"sort": 1,
"node": null
},
{
"id": 9,
"name": "影视",
"parentId": 7,
"isParent": false,
"sort": 2,
"node": null
},
{
"id": 10,
"name": "教育音像",
"parentId": 7,
"isParent": false,
"sort": 3,
"node": null
}
]
},
{
"id": 11,
"name": "英文原版",
"parentId": 1,
"isParent": true,
"sort": 3,
"node": [
{
"id": 12,
"name": "少儿",
"parentId": 11,
"isParent": false,
"sort": 1,
"node": null
},
{
"id": 13,
"name": "商务投资",
"parentId": 11,
"isParent": false,
"sort": 2,
"node": null
},
{
"id": 14,
"name": "英语学习与考试",
"parentId": 11,
"isParent": false,
"sort": 3,
"node": null
},
{
"id": 15,
"name": "文学",
"parentId": 11,
"isParent": false,
"sort": 4,
"node": null
},
{
"id": 16,
"name": "传记",
"parentId": 11,
"isParent": false,
"sort": 5,
"node": null
},
{
"id": 17,
"name": "励志",
"parentId": 11,
"isParent": false,
"sort": 6,
"node": null
}
]
},

2个回答

你问题描述的不清楚,想弄成什么样,截个图来好吧

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐