Vue input file upload multiple times does not trigger the change event problem

Problem Description

The page uses the upload image, I use the input file, but when I select an image and click the input again to select an image, there is no response

  • I checked online and said that the value of the input needs to be cleared, and the change event will be triggered next time.
    I tried ===> to no avail
  • Said to replace the original input element and re-render the input element,
    I tried ===> to no avail
  • Say, put the input into a form, and when the input change event is called back,
    I tried to reset the form ===> to no avail
  • In the end, when I was in despair, I saw a glimmer of light. A netizen said that the change event was not bound.
    I tried it ===> Ah ha ha ha ha ha ha, bingo

Summary: replace the input element, re-render, and then bind the change event function

Reference link https://www.cnblogs.com/exhuasted/p/6185874.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324988769&siteId=291194637