http请求

jun_materials-request

http数据请求,包括:get post put等

API

参数名 说明 必填 类型 默认值 备注
type 类型 string - get、post、upload
url 接口地址 string - '/api/xxxx'
config 参数配置 object - get、post、upload
percentCompletedFun 上传进度 function - upload上传进度回调方法

DEMO 列表

Request

本 Demo 演示一行文字的用法。

import React, { Component } from 'react';
import ReactDOM from 'react-dom';
import Request from 'jun_materials-request';

class App extends Component {
  render() {
    return (
      <div>
        
      </div>
    );
  }
  get = (url) => {
    Request('get','url',param)
  }
  post = (url) => {
    Request('post','url',param)
  }
  post = (url) => {
    Request('upload','url',param,null,(percent)=>{})
  }
}

ReactDOM.render((
  <App />
), mountNode);