<ProFormUploadButton label="上傳憑證" max={1} name="file" rules={[{ required: true, message: '請上傳到款憑證' }]} action="/api/common/uploadimage" //上傳圖片接口地址 onChange={(e) => { if (e.file.status == 'removed') { //移除圖片時; SetVoucherImg('') } else if (e.file.status == 'done') { //上傳完成時 if (e.file.response.Type == 200) { SetVoucherImg(e.file.response.Data) } else { message.error(e.file.response.Content ?? '上傳失敗') } } else if (e.file.status == 'error') { //上傳錯誤時 message.error('上傳失敗') }
//status狀態:'error' | 'success' | 'done' | 'uploading' | 'removed'; }} />
當狀態為done時,response為服務器返回數據