javascript
JSON.parse(JSON.stringify(data))
将后端传入的JSON数据data放入该方法的参数中,返回的结果就是JavaScript对象
比如将后端传入的对象key作为对象,而不是字符串双引号格式
javascript
{
"path": "/home",
"name": "home",
"label": "首页信息",
"icon": "s-home",
"url": "Home.vue",
"children": null
},
{
"path": "/mall",
"name": "mall",
"label": "商品管理",
"icon": "video-play",
"url": "Mall.vue",
"children": null
},
就可以使用该方法来转为JS的对象来使用