Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

处理后台axios成功返回的数据(数组类型) #1053

Open
lichangchao15442 opened this issue Feb 22, 2020 · 0 comments
Open

处理后台axios成功返回的数据(数组类型) #1053

lichangchao15442 opened this issue Feb 22, 2020 · 0 comments

Comments

@lichangchao15442
Copy link

  1. 功能需求 => 详细说明:/utils/request.js中分数据类型处理后台axios成功返回的数据
  2. Bug反馈 :在处理object类型时,似乎有点小问题: let result = {} if (typeof data === 'object') { result = data // 数组给了两次值 if (Array.isArray(data)) { result.list = data } } else { result.data = data }
    2.1 简单描述下报错
    举例:data为数组[0,1,2]===>result就为===>0,1,2,list:[0,1,2]
    2.2 你期望什么结果
    result = data if (Array.isArray(data)) { result.list = data }
    修改为
    if (Array.isArray(data)) { result.list = data } else {result = data}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant