Need help with vue-axios?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

heuuLZP
219 Stars 172 Forks MIT License 12 Commits 3 Opened issues

Description

封装axios

Services available

!
?

Need anything else?

Contributors list

# 148,674
JavaScr...
HTML
axios
vue2
7 commits
# 239,413
JavaScr...
HTML
axios
vue2
2 commits

vue-axios

用法

克隆仓库到本地

git clone https://github.com/heuuLZP/vue-axios.git

进入仓库根目录,安装依赖

npm install

启动项目

npm run dev

查看效果

自行修改

src/components/Hello.vue
文件中第24行中的如下所示代码。
  • 正常请求
    http.get(api.right, params)
    
  • 地址不存在
    http.get(api.error, params)
    
  • 参数不正确
    http.get(api.backEnd, params)
    

项目结构

src
├── App.vue
├── assets
│   └── logo.png
├── components
│   └── Hello.vue
├── main.js
├── router
│   └── index.js
└── utils         ## 工具
    └── api.js    ## 封装api
    └── http.js   ## 封装axios

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.