26 lines
681 B
TypeScript
26 lines
681 B
TypeScript
import { Button, message, Upload, UploadProps } from "antd";
|
|
|
|
const Uploads = () => {
|
|
const props: UploadProps = {
|
|
name: "file",
|
|
action: `http://127.0.0.1:12216/v1/public/fts/uploadFore`,
|
|
headers: {
|
|
authorization: window.localStorage.getItem("token")??''
|
|
},
|
|
onChange(info: any) {
|
|
if (info.file.status === "done" && info.file.response.code !== 200) {
|
|
message.error(`${info.file.response.msg}`);
|
|
} else if (info.file.status === "error") {
|
|
message.error(`${info.file.name} file upload failed.`);
|
|
}
|
|
},
|
|
};
|
|
return (
|
|
<Upload {...props}>
|
|
<Button>导入</Button>
|
|
</Upload>
|
|
);
|
|
};
|
|
|
|
export default Uploads;
|