🐛(upload): 修复 upload 组件连续选择两个相同文件无法触发上传的问题
This commit is contained in:
parent
2600e6756f
commit
45746111b8
@ -234,7 +234,7 @@ const errorF = (errorText: string) => {
|
||||
};
|
||||
|
||||
const localUpload = (option: localUploadOption, callback: Function) => {
|
||||
let xhr: XMLHttpRequest, loadedevt, total, per: number, url, uploading;
|
||||
let xhr: XMLHttpRequest, url;
|
||||
xhr = new XMLHttpRequest();
|
||||
url = option.url;
|
||||
let formData = option.formData;
|
||||
@ -279,6 +279,7 @@ const localUpload = (option: localUploadOption, callback: Function) => {
|
||||
if (cb && typeof cb == "function") {
|
||||
cb();
|
||||
}
|
||||
(orgFileInput.value as HTMLInputElement).value = "";
|
||||
};
|
||||
|
||||
const filetoDataURL = (file: File, fn: Function) => {
|
||||
|
@ -13,7 +13,7 @@
|
||||
::: demo 使用 `lay-upload` 标签, 创建一个上传按钮
|
||||
|
||||
<template>
|
||||
<lay-upload @done="getUploadFile" field="bigFile" @choose="beginChoose">
|
||||
<lay-upload url="https://www.mocky.io/v2/5cc8019d300000980a055e76" @done="doneHandle" field="bigFile" @choose="beginChoose">
|
||||
<template #preview>
|
||||
<div v-for="(item,index) in picList" :key="`demo1-pic-'${index}`">
|
||||
<img :src="item"/>
|
||||
@ -35,7 +35,8 @@ export default {
|
||||
};
|
||||
reader.readAsDataURL(file);
|
||||
};
|
||||
const getUploadFile=(files)=>{
|
||||
const doneHandle=(files)=>{
|
||||
console.log("触发")
|
||||
if(Array.isArray(files)&&files.length>0){
|
||||
files.forEach((file,index,array)=>{
|
||||
filetoDataURL(file,(res)=>{
|
||||
@ -50,7 +51,7 @@ export default {
|
||||
console.log("beginChoose",e);
|
||||
};
|
||||
return {
|
||||
getUploadFile,
|
||||
doneHandle,
|
||||
filetoDataURL,
|
||||
beginChoose,
|
||||
picList
|
||||
|
Loading…
Reference in New Issue
Block a user