请求一个接口,但是这个接口里面有$ref的字段,内容无法正常显示这是请求到的数据..后端说是要把这个字段的值替换成state.downloadCategoryMap重新请求一下就变正常了大家有遇到这种情况的吗?这是后端给出的处理办法 ↓↓↓let diguiReflectList = (theObj) => { if (theObj) { if (theObj.children) { theObj.children = theObj.children.map(item => diguiReflectList(item)); } if (theObj["$ref"]) { return eval(theObj["$ref"] .replace("\$.data.downloadCategory", "state.downloadCategoryMap") .replace("\$.data", "state.downloadCategoryMap"));//千万注意二级路径的问题 } else { theObj.title = theObj.id; theObj.expand = true; state.downloadCategoryMap[theObj.id] = theObj; return theObj; } } else { return theObj; } };
添加回答
举报
0/150
提交
取消