Git Product home page Git Product logo

axios-packaging's Introduction

Axios小助手 一款基于Axios的请求管理工具

npm


项目使用图片


介绍

  • axios的使用体验更加愉快
  • 请求API做了统一的管理,方便调用
  • 请求相关配置更加透明化,开放接口供用户配置
  • 自由开发相关模块

代码对比

GET请求


项目使用图片


须知

注意事项: 引入前请先下载本项目的依赖Axios npm i axiosyarn add axios

Installing

Using npm:
$ npm i axiospackaging
Using yarn:
$ yarn add axiospackaging
Using cdn:
$ 待定,还没时间

使用

框架中的使用

Using Vue Import:
vue-demo

Using React Import: 待定,还未有时间,如果你想帮我测试的话,万分感谢!

本地使用

1.引入

import HTTP from 'axiospackaging'

2.配置实例

// 实例配置
HTTP.instance.defaults.baseURL = 'http://localhost:9000/api'
HTTP.instance.defaults.timeout = 1000
// 实例注册
Vue.prototype.$http = HTTP

3.使用请求

import api from './request/api' // 引入请求API
····
fetchData: async function () {
  let params = {}
  const res = await this.$http.get(api.请求名,params)
}
····

请求配置

全局配置:

  • HTTP.instance.defaults.baseURL
  • HTTP.instance.defaults.timeout

API

get
this.$http.get(url,params)
post
this.$http.post(url,data)

Resources

使用证书(License)

联系作者

QQ: 766140773
邮箱: [email protected]

axios-packaging's People

Contributors

ricemonster avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.