Please teach me how to use vue-upload-component

vue-upload-component is used in the project to upload files, press demo to set pos-action, etc., but why is request-method options,? ask how to set it to post

          <file-upload
            :headers="{"Content-Type":"multipart/form-data"}"
            post-action="http://192.168.121.24:1400/cmsWeb/api/crm/talk/upLoadFile"
            put-action="http://192.168.121.24:1400/cmsWeb/api/crm/talk/upLoadFile"
            class="btn btn-primary"
            extensions="gif,jpg,jpeg,png,webp"
            accept="image/png,image/gif,image/jpeg,image/webp"
            :multiple="false"
            :size="1024 * 1024 * 10"
            v-model="files"
            @input-filter="inputFilter"
            @input-file="inputFile"
            ref="upload">
            <i class="fa fa-plus"></i>
            Select files
          </file-upload>
inputFilter(newFile, oldFile, prevent) {
      if (newFile && !oldFile) {
        // Before adding a file
        // 
        // Filter system files or hide files
        //  
        if (/(\/|^)(Thumbs\.db|desktop\.ini|\..+)$/.test(newFile.name)) {
          return prevent()
        }
        // Filter php html js file
        //  php html js 
        if (/\.(php5?|html?|jsx?)$/i.test(newFile.name)) {
          return prevent()
        }
      }
    },
    inputFile(newFile, oldFile) {
      this.$refs.upload.active = true
      if (newFile && !oldFile) {
        // add
        console.log("add", newFile)
      }
      if (newFile && oldFile) {
        // update
        console.log("update", newFile)
      }
      if (!newFile && oldFile) {
        // remove
        console.log("remove", oldFile)
      }
    }


Options is a pre-check interface for a non-simple request to the server api, and the real request will not be sent until it is passed. For simple and non-simple requests, take a look at the article .
for example: the GET request is a simple request, and the OPTIONS; post request will not be sent first as a non-simple request. If the OPTIONS, is sent first, it needs the backend to release the OPTIONS method on the API, or 200 will be returned for the OPTIONS release method.
your problem is not that post becomes options, but that the options before post is not returned correctly and needs to be dealt with by the backend.


  • first understand what the OPTIONS request is for. Refer to OPTIONS request
  • your interface reported a 500th error, but the server made an error and eliminated the server error. If it is a locally built server, you should be able to see the error from the console
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5f5dc-45836.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5f5dc-45836.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?