Problems encountered in uploading files by element-ui

now you need to upload the attachment to the server. The file type can only be processed by doc,png,txt, before it is submitted.
the following example is basically picked from the official website of element-ui, because I only need to upload one file, so is it correct to set limit to 1?
action does not know how to write. Now it is developed locally in localhost. The interface given to the proxy / api, backend in webpack is / api/xxx
then how should my action write

<el-upload
                          class="upload-demo"
                          ref="upload"
                          action="https://jsonplaceholder.typicode.com/posts/"
                          accept="application/msword, image/png"
                           :limit="1"
                          :before-upload="beforeUpload"
                          :on-preview="handlePreview"
                          :on-remove="handleRemove"
                          :on-change = "handleChange"
                          :file-list="fileList"
                          :auto-upload="false">
                          <el-button slot="trigger" size="small" type="primary"></el-button>
                          <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload"></el-button>
                          <div slot="tip" class="el-upload__tip">txt,doc,png10M</div>
                        </el-upload>

the last question I only need to ask the user to upload a file. There are two pictures by default on the official website. I changed fileList to an empty array []
. There is a slight problem. I print an empty array of this.fileList, in all the methods provided by element-ui, but I clearly select a file

.

clipboard.png

clipboard.png

clipboard.png

clipboard.png


action just write / api/xxx directly, and the webpack agent will rewrite all requests that conform to the proxy rules

.

as for the problem that fileList can't be printed, you need to post the complete code

.

bind on-success,on-error to see if the upload is successful. Take a look at more official examples
clipboard.png


auto-uploadtrue
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-1e8690b-de8.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-1e8690b-de8.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?