The problem of on-error callback for uploading pictures using the upload component of iview component library

upload an image using the upload component of the iview component library, and the backend will verify the width and height of the image. If it is incorrect, the following error will be thrown:

code:"failure"
result:"upload.invalid.size"

as far as I understand it, it should be the on-error callback of the upload component, but it is the on-succes callback. What is the reason?

Mar.07,2021

it is recommended to take a look at the source code of the upload component in iview . The upload method in the
source code is ajax . The handleSuccess method is called after a successful request, and the handleError method is called after the request fails.

Menu