R
R
Renhor2019-12-12 12:27:43
Vue.js
Renhor, 2019-12-12 12:27:43

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}`
    });
  }
};

And the picture began to load quietly in the preview. So the question arose, what is the semantic load of the attribute?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2019-12-12
@Renhor

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 question

Ask a Question

731 491 924 answers to any question