Upload button

Updated at:

The upload button is a basic Moflow component that uploads information to a server when a user clicks it.

Configuration items

Category

Setting

Example

Description

Content

Button text

The text on the button.

Button type

The type of the button. Options include the following: Primary button, Default button, Dashed button,

Text button, and Link button.

Enable badge

Enables the badge.

Badge configuration

Number: The number to display.

Overflow number: If the displayed number is greater than the overflow number, it shows as `overflow number`+.

Red dot: If the number is greater than 0, a red dot is shown instead of the number.

Show zero: Specifies whether to show the badge when the number is 0.

Size: The size of the badge.

Hover tooltip

Specifies whether to enable the hover tooltip.

Hover tooltip configuration

Content: The text content of the hover tooltip.

Background color: The background color of the hover tooltip.

Position: The position of the hover tooltip relative to the button.

Trigger method: The method to trigger the tooltip display. Options are hover and click.

Extension configuration

Prefix icon

The prefix icon for the upload button.

Suffix icon

The suffix icon for the upload button.

File type

The file types. Separate multiple types with commas. For example, `.xls, .xlsx` restricts uploads to Excel files.

Maximum number

The maximum number of files allowed for multiple file uploads.

Selector type

The type of selector. Options include the following: Single file, Multiple files, and Folder.

Data conversion

Automatically parses the file content.

Label

The label. For more information, see General form properties.

Interaction

Hide

Hides the component. For more information, see General properties.

Keep layout when hidden

Keeps the layout when hidden. For more information, see General properties.

Action

The action. For the default behavior, you must specify an upload URL. The Alibaba Cloud OSS pattern only supports single files. Options include the following: Default, Upload to system file storage, and Upload to Alibaba Cloud OSS.

System path

Select the target system path for the upload.

Upload method

The upload method. Options include the following: POST, GET, and PUT.

Upload URL

For the default action, set the upload URL.

OSS credential operation

Create an OSS integration operation and select it. For files larger than 5 GB, select the integration operation type for multipart upload credentials.

Upload size limit

The upload size limit.

Validation

Validation. For more information, see General form properties.

Loading

image

Shows the component in a loading state.

Disable

image

Disables the component. A disabled component cannot be interacted with.

Style

Margin

The outer margin. For more information, see General properties.

Ghost style

image

The ghost style is suitable for visually complex backgrounds. It provides lightweight interface elements and is common on display pages.

Danger button

Marks an operation that may have critical consequences.

Button shape

The shape of the button. Options include the following: Default, Circle, and Rounded.

Button layout

The layout of the button within its container. Options include the following: Full width, Left, Center, and Right.

CSS styles

Border radius

For more information, see General properties.

Button content font size

The font size of the button content.

Button content line height

The line height of the button content.

Default button active background color

For more information, see General properties.

Default button active border color

For more information, see General properties.

Default button active text color

For more information, see General properties.

Default button hover background color

For more information, see General properties.

Default button hover border color

For more information, see General properties.

Default button hover text color

For more information, see General properties.

Default button background color

For more information, see General properties.

Default button border color

For more information, see General properties.

Default button text color

The text color of the default button.

Primary button active background color

For more information, see General properties.

Primary button active text color

The text color of the active primary button.

Primary button hover background color

For more information, see General properties.

Primary button hover text color

The text color of the hovered primary button.

Primary button background color

For more information, see General properties.

Primary button text color

For more information, see General properties.

Link button active text color

The text color of the active link button.

Link button text color

The text color of the link button.

Link button hover text color

The text color of the hovered link button.

Text button active background color

For more information, see General properties.

Text button disabled text color

The text color of the disabled text button.

Text button text color

The text color of the text button.

Text button hover background color

For more information, see General properties.

Properties and methods

Name

Type

Example

Description

text

string

buttonuploader.text

The button text.

loading

boolean

buttonuploader.loading

The loading state of the button.

disabled

boolean

buttonuploader.disabled

Specifies whether to disable the current button.

value

array

buttonuploader.value

A list of paths for the files selected in the current file upload component.

mode

string

buttonuploader.mode

Read-only. The mode of the current file upload component.

parsedValues

array

buttonuploader.parsedValues

Read-only. A list of converted files from the files selected in the current file upload component.

action

string

buttonuploader.action

The default upload action. The value can be one of the following: `default` (default), `system` (upload to system file storage), or `aliyun-oss` (upload to Alibaba Cloud OSS).

disableUpload

boolean

buttonuploader.disableUpload

Specifies whether the upload is blocked.

extraHeader

object

buttonuploader.extraHeader

Additional request headers for the upload.

extraData

object

buttonuploader.extraData

Additional data for the upload.

method

string

buttonuploader.method

The upload method.

uploadProgress

number

buttonuploader.uploadProgress

The upload progress.

validationMessage

string

buttonuploader.validationMessage

The validation result message.

validationStatus

boolean

buttonuploader.validationStatus

Specifies whether the validation is passed.

clearValue

func

buttonuploader.clearValue()

Clears the component's `value`.

setText

func

buttonuploader.setText('Upload image')

Sets the button text.

setLoading

func

buttonuploader.setLoading(true)

Sets the loading state of the button.

setDisabled

func

buttonuploader.setDisabled(true)

Sets whether to disable the current button.

setValue

func

buttonuploader.setValue(null)

Sets the list of paths for the files selected in the current file upload component.

setDisableUpload

func

buttonuploader.setDisableUpload(true)

Sets the flag to block uploads.

setExtraHeader

func

buttonuploader.setExtraHeader({Connection: 'keep-alive'})

Sets additional upload headers.

setExtraData

func

buttonuploader.setExtraData({data:'data'})

Sets additional upload data.

setAction

func

buttonuploader.setAction('system')

Sets the upload behavior of the component.

setMethod

func

buttonuploader.setMethod('post')

Sets the upload method.

click

func

buttonuploader.click()

Click

clearValidate

func

buttonuploader.clearValidate()

Clears the validation status.

validate

func

buttonuploader.validate()

Validates the component.

Event callbacks

Configuration

Description

Callback that is triggered when the file status changes.

Callback that is executed before an upload.

Callback that is triggered when an upload succeeds.

Callback that is triggered when an upload fails.