We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
上传失败后手动设置上传失败的status后,hover的话会出现代码
upload组件代码
<Upload listType="picture-card" maxCount={1} fileList={fileList} onPreview={handlePreview} onChange={handleChange} > {fileList.length !== 1 && uploadButton} </Upload>
tsx文件handleChange代码
const [fileList, setFileList] = useState<UploadFile[]>([]); const handleChange: UploadProps['onChange'] = async (info) => { setFileList(info.fileList); if (info.file.status === 'uploading') { return; } if (info.file.status === 'done') { const formData = new FormData(); formData.append('file', info.file.originFileObj as File); try { const res = await upload(formData); console.log(res); if (res.code === 1) { message.success('上传成功'); setImageUrl(res.data); } else { // 设置上传失败的状态 // 异步更新预览图片 setFileList((prevFileList) => [ { ...prevFileList[0], status: 'error', // 上传错误 }, ]); } } catch (error) { // 异步更新预览图片 setFileList((prevFileList) => [ { ...prevFileList[0], status: 'error', // 上传错误 }, ]); } } };
hover后出现预览效果,不应该是一串html代码
The text was updated successfully, but these errors were encountered:
No branches or pull requests
🐛 bug 描述
上传失败后手动设置上传失败的status后,hover的话会出现代码
📷 复现步骤 | Recurrence steps
upload组件代码
tsx文件handleChange代码
🏞 期望结果 | Expected results
hover后出现预览效果,不应该是一串html代码
© 版本信息
The text was updated successfully, but these errors were encountered: