Answer the question
In order to leave comments, you need to log in
What is the purpose of the action property in the Element UI - Upload component?
Good day! I did not quite understand the purpose of this required attribute. The url is specified in the documentation example:
https://jsonplaceholder.typicode.com/posts/
On localhost and hosting, this url responds with an error (CORS policy), I just created an empty controller in the project:
module.exports.postAvatar = async (req, res) => {
try {
res.json({
success: true
});
} catch (e) {
res.json({
success: true,
message: `Ошибка. ${e.message}`
});
}
};
Answer the question
In order to leave comments, you need to log in
This parameter is responsible for where the selected file will actually be sent. The component is called "Upload", not "Preview", which is why the parameter is required.
If you don't really need to upload the file, or if you need special logic, use the http-request parameter.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question