获取分类信息有错误?

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 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年前 评论

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