图片上传组件
使用方式
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>