what if the same file is added multiple times and only one file is displayed and only one file is uploaded in elementUI when el-upload uploads the same file?
what if the same file is added multiple times and only one file is displayed and only one file is uploaded in elementUI when el-upload uploads the same file?
8.1k reading of this question, but there is no appropriate answer yet. Now to see this question to answer may be too late for the landlord, but still seriously code, hoping to be helpful to the follow-up people.
I know what the landlord means, because setting : auto-upload=false
requires a hook for before-add to see if the file is duplicated before adding, but element-ui does not provide a hook for before-add. However, you can see how to solve this problem by looking at the source code of element-ui. The file in el-upload is packaged. If you want to add a file, file.status will be set to ready, and upload will be set to uploading,. Successful upload will be set to success, upload failure will be set to fail. The on-change hook is described as "the hook when the state of the file changes, and it will be called when the file is added, uploaded successfully and failed." you can see that "add file" is included here, but does not include "delete file", so you can do this: bind the on-change function and determine whether the incoming file.status is ready or not to determine whether to add a file. Because from the above description, we can see that "on-change discovers file.status='ready'
" to "on-change is ready to add files" is at least a single shot.
the following code is attached:
vue template (is written in pug, saving the number of words):
changeUpload(file, fileList) {
this.fileList = fileList.slice(-1)
}
Previous: How to add registry files to child_process.exec
Next: How do I check to see if a project is written in react?
For the project of elemen-ui+vue, switch the filter items on the table, get the new list, replace the text, and then replace the picture after a while. Is there any good way to solve this problem? ...
the demand has changed. Previously, you only need to submit the id array of the selected leaf node, and then you can get it directly through the official api [getCheckedKeys]. Now it is required to also pass the id of the parent node. get stuck. Many ...
in the development of the ElementUI+Express project, uploading pictures encountered this problem: 1ElementUI: <el-upload action="http: localhost goods addNewGoodsPicture" :limit="1" :onError="uploadError" :onSuccess=&q...
Click the corresponding tag to close the corresponding page, how to write this, please < template > ...
there is such a background system, which is divided into many systems and modules, which involves a lot of operation permissions, and each lander is assigned different permissions, so the operable menus and visible pages are also different. the previo...
< template scope= "scope " > <el-button type="text" size="small">< el-button> <el-button @click="handleClick(scope.row)" type="text" size="small">< el-button> <el...
<el-select @change="orgChange" v-model="sectionNameOpt" filterable placeholder=""> <el-option v-for="item in sectionNameOpts" :key="item.index" :label="item.orgN...
<el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" @select="handleSelect"> <el-menu-item index="1">< el-menu-item> <el-submenu index="2">...
A column in the page table has an el-tooltip,. Whether it is displayed or not is controlled by v-if, and how to make it not only display when v-if is established, but also pop up tips text prompts? <span v-if="x" @click.stop=...
...
after uploading a file using el-upload, the page has to be refreshed every time before uploading again. How to clear the contents of the file in el-upload after uploading the file (regardless of success or failure)? ...
Technical note: vue-cli+elementUI table control Business scenario description: 1.tabletable 2.end_date 3. 4.10>;10>ago solution: use the row-class-name attribute in the elementUI talbe control to determine whether to include the specified fiel...
now the situation is like this. My component is written in JSX as a child component. The props, sub-components that are not collected by the parent component should be picked up by this.$attrs, and they have indeed been received, but how can they be wri...
introduce vue.min.js webpack.base.conf.jsexternalsvue tabletable into index.html according to the version used if import vue, removes externals and introduces cdn in main.js, it will load normally could you tell me what s wrong with my use? ...
in the chrome browser, the component does not change, switch the window after selecting a tab, and then switch back, a blue border will appear, and after selecting the others, it will disappear. ...
for example, after expanding like the following, click on the contents but the menu bar will not automatically withdraw what should be solved, thank you! the content below me is wrapped in router-view the code for the horizontal menu bar is as fo...
such as headings, I want to sort the form by dragging within el-dialog. can be dragged if it is placed on the general surface. indicates that I have correctly introduced sortablejs into , but if I put the form on el-dialog, drag sorting will become ...
there is a requirement that when Select selects a city, it needs fuzzy search, which supports not only Chinese, but also pinyin, acronyms and so on. The back end will give me the corresponding fields, but I find that using filter-method to pass in funct...
now use Element-UI to upload files, and then need to use the clearFiles method, but how many failed attempts? the examples found in Github Issues did not run successfully either https: github.com ElemeFE el. ...
< H2 > question < H2 > the frontend uses the same Form, newly added data edited and added in a page of vue+elementUI, to successfully reach the backend. Because the data of the wrong type is returned from the backend API when modified, the time error ...