Element-ui cooperates with vue to upload pictures

Here I will introduce you are you hungry? ui cooperates with vue to encapsulate a component for uploading pictures 

First of all, let's take a look at the introduction of each hook function of the Are you hungry ui document!

The on-preview attribute is generally used when previewing pictures.

The on-remove attribute is executed when the file is deleted. Generally, we filter the array here to ensure that it is the latest array.

On-change will trigger this function method when the file is selected. Here we can operate which of our selected files

before-upload is a function method triggered by file upload. Most of us will perform various checks on the size and type of pictures here.

http-request is a custom upload. Most of the uploads we really mean use this function to upload real pictures. You can also upload third-party servers for resource management.

Here are several function methods (applicable to most environments)

I will upload the comments in the upload component packaged by myself below. I also wrote very clearly. I hope you can understand the comments in depth.

 

If you are interested, you can read more information, thank you

Here is the link to Are You Hungry UI: Element - The world's most popular Vue UI framework

Guess you like

Origin blog.csdn.net/m0_71231013/article/details/126139521