0.0.16 • Published 3 years ago

react-upload-zwc v0.0.16

Weekly downloads
37
License
MIT
Repository
github
Last release
3 years ago

ReadMe Card

React Upload Component

GitHub license npm version

· This is a file upload component for react.

· Support Typescript

Environment Support

IE / EdgeFirefoxChromeSafari
IE11, Edgelast 2 versions44last 2 versions

Installation

npm i -S react-upload-zwc

Scripts

# Install dependencies
npm i

# Run demo
npm run start

Example

http://localhost:3002/

Usage

import React from 'react';
import Upload from 'react-upload-zwc';

const { Dragger } = Upload;

React.render(
  <div>
    <Upload
      action="http://localhost:9001/api/upload"
      onChange={changeFiles}
      multiple={true}
    >
      上传文件
    </Upload>

    <Dragger
      width={300}
      height={300}
      action="http://localhost:9001/api/upload"
    >
      <p>
        拖拽文件
      </p>
    </Dragger>
  </div>,
  container
);

API

Upload props

nametypedefaultdescription
acceptstring-Types for files to accept which is used to upload.See input accept Attribute.
actionstring|((file: File[]) => Promise)-Address to upload.
classNamestring-Label component className.
method'post'|'get''post'Request method.
directoryboolean"span"Can upload folders.
onChange(file: File[] | FileList | null) => any-Emit function when upload file change.
styleCSSProperties{}Label component style
dataObject-Upload required additional parameters.
fileNamestring'file'Name for upload files.
multiplebooleanfalseMultiple files can be uploaded.
beforeUpload(files: FileList | File[] | null) => (boolean | Promise<any>)-Emit function before upload.
uploadSuccess(...rest: any[]) => any-Triggered after successful upload.
uploadFailed(...rest: any[]) => any-Triggered after upload failed.
disabledbooleanfalseIf disabled
outterClassNamestring-Outter wrapper.
innerClassNamestring-Inner wrapper.

Dragger props

nametypedefaultdescription
heightnumber100Set height of dragger
widthnumber100Set width of dragger

License

React is MIT licensed.

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.10

3 years ago

0.0.11

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago