/**
 * title: ""
 * description: ""
 */
import React from 'react';
import { Icon, Upload, Button } from '@alicloud/console-components';

function beforeUpload(info) {
  console.log('beforeUpload : ', info);
}

function onChange(info) {
  console.log('onChange : ', info);
}

function onSuccess(info) {
  console.log('onSuccess : ', info);
}

export default () => {
  return (
    <div>
      <Upload
        action="https://upload-server.alibaba.net/upload.do"
        beforeUpload={beforeUpload}
        onChange={onChange}
        onSuccess={onSuccess}
        listType="text"
        defaultValue={[
          {
            name: 'IMG.png',
            state: 'done',
            url: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
            imgURL: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
          },
          {
            name: 'IMG.png',
            state: 'uploading',
            percent: 50,
            downloadURL: '',
            fileURL: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
            imgURL: '',
          },
          {
            name: 'IMG.png',
            state: 'error',
            errorMsg: '上传失败提示',
            url: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
            downloadURL: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
            imgURL: 'https://img.alicdn.com/tps/TB19O79MVXXXXcZXVXXXXXXXXXX-1024-1024.jpg',
          },
        ]}
      >
        <Button>
          <Icon type="upload" size="small" />上传本地文件
        </Button>
      </Upload>
    </div>
  );
};


