@deepjs/uni-axios

0.3.7 • Public • Published

uni-axios

自定义适配器,支持在 uni-app 中使用 axios

依赖 axios,兼容性好,并提供最佳实践

使用

// main.js
import axios from '@deepjs/uni-axios'

Vue.prototype.$axios = axios
// api/user.js文件
const api = require("./api.js");
import Vue from 'vue';

// 获取登陆验证码
export const userRegister = (params) => {
  return Vue.prototype.$axios.post(
    api.userRegister,
    params,
  )
}
// page.vue
const apiUser = require('@/api/user')
//.........
apiUser.userRegister(params).then(res => {
    console.log("获取登陆验证码成功啦:",res)
  }).catch(err => {
    console.log("获取验证码失败啦:",err)
  })

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i @deepjs/uni-axios

    Weekly Downloads

    2

    Version

    0.3.7

    License

    MIT

    Unpacked Size

    15.2 kB

    Total Files

    5

    Last publish

    Collaborators

    • cloudyan