Skip to content

Upload Component Echo

This guide explains how to display images after uploading in form-create's upload component to ensure images can be correctly displayed in forms.

Note

You need to assign the URL from the interface response to file.url through the onSuccess callback. Otherwise, the form will not be able to obtain the component's data.

Upload Images

The following uses Element Plus as an example to show how to display uploaded images. The parameter order of other UI frameworks may differ. See the relevant official documentation for specific details.

Define File Name

The following uses Element Plus as an example to show how to define file names.

Explanation

  • action: The API endpoint URL for uploading files.
  • onSuccess: The callback function after successful upload, handling the response after upload, updating file.url or other required data.
  • file.url: You must assign the URL after successful upload to file.url, otherwise the form will not be able to obtain image data.
  • file.value: If you expect the upload component's value type to be object[], you need to assign the upload result data to file.value.

props

ParameterDescriptionTypeOptional ValuesDefault Value
onSuccessHook when file upload is successful function (res, file) {file.url = res.data.filePath;} Echo by assigning value to file.url in the callbackfunction(response, file, fileList)

FormCreate is an open-source project released under the MIT License. Free for personal and commercial use.