图片上传组件

使用方式

//自己的第三方组件
import {
    Buttons,
    Upload,
Icon} from '../components/index';

//数据流向
const props = {
    name: 'file',
    action: 'http://text.com/uploadApi.php',
    headers: {
        authorization: 'authorization-text',
    },
    onChange(info) {
        if (info.file.status !== 'uploading') {
            console.log(info.file, info.fileList);
        }
        if (info.file.status === 'done') {
           alert(`${info.file.name} 上传成功。`);
        } else if (info.file.status === 'error') {
            alert(`${info.file.name} 上传失败。`);
        }
    }
};

<Upload {...props}>
                        <Buttons><Icon type="cloudupload"/>点击上传文件</Buttons>
                    </Upload>

results matching ""

    No results matching ""