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