zz-fetch

基于axios封装的请求包

Usage no npm install needed!

<script type="module">
  import zzFetch from 'https://cdn.skypack.dev/zz-fetch';
</script>

README

fetch

基于axios封装的业务请求包

import {Fetch, Method} from 'zz-fetch'
const fetch = new Fetch('http://api.xxx.com')
export class Interface {
  getData (params) {
    return fetch.send({
      url: '/xxx',
      method: 'get',
      params
    })
  }
  setData (data) {
    return fetch.send({
      url: '/xxx',
      method: Method.post,
      data
    })
  }
}

// 取消请求
const inter = new Interface()
let params = {}
inter.setData(params)
params.cancel()