获取分类信息有错误?

《L04 微信小程序从零到发布》
从小程序个人账户申请开始,带你一步步进行开发一个微信小程序,直到提交微信控制台上线发布。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
liyu001989
最佳答案

更新了教程了,修改一下request 方法。

src/utils/api.js

// 普通请求
const request = async (options, showLoading = true) => {
  if (typeof options === 'string') {
    options = {
      url: options
    }
  }
.
.
.
}

遇到报错可以查看一下日志,看看具体报错的位置

5年前 评论
讨论数量: 8
liyu001989

更新了教程了,修改一下request 方法。

src/utils/api.js

// 普通请求
const request = async (options, showLoading = true) => {
  if (typeof options === 'string') {
    options = {
      url: options
    }
  }
.
.
.
}

遇到报错可以查看一下日志,看看具体报错的位置

5年前 评论

妹子提问很活跃啊 :+1:

5年前 评论

@FMW 主要是有些东西不太懂,我不是搞研发的。。我运维。。

5年前 评论
你看我吊吗啊

@liyu001989 @xinjiahui
我在请求分类列表这个api 的时候 ,有如下报错。。。

TypeError: Cannot create property 'url' on string 'categories'
    at _callee$ (http://127.0.0.1:59229/appservice/utils/api.js:39:25)
    at tryCatch (http://127.0.0.1:59229/appservice/npm/regenerator-runtime/runtime.js:65:40)
    at Generator.invoke [as _invoke] (http://127.0.0.1:59229/appservice/npm/regenerator-runtime/runtime.js:303:22)
    at Generator.prototype.(anonymous function) [as next] (http://127.0.0.1:59229/appservice/npm/regenerator-runtime/runtime.js:117:21)
    at step (http://127.0.0.1:59229/appservice/utils/api.js:13:191)
    at http://127.0.0.1:59229/appservice/utils/api.js:13:437
    at Promise (<anonymous>)
    at Object.<anonymous> (http://127.0.0.1:59229/appservice/utils/api.js:13:99)
    at Object.request (http://127.0.0.1:59229/appservice/utils/api.js:72:17)
    at TopicIndex._callee$ (http://127.0.0.1:59229/appservice/pages/topics/index.js:77:38)
5年前 评论
你看我吊吗啊

@JeffLi 改成这样 OJBK 了 哈哈

let categoriesResponse = await api.request({
            url : 'categories' ,
            data:{

            }
          })
5年前 评论
liyu001989

file

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!