Skip to content

add missing proptype for 'drop' property #405

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions src/FileUpload.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<span :class="className">
<slot></slot>
<label :for="forId"></label>
<label :for="forId"></label>
<input
v-if="!reload"
ref="input"
Expand Down Expand Up @@ -262,6 +262,7 @@ export default defineComponent({
default: 0,
},
drop: {
type: Boolean,
default: false,
},
dropDirectory: {
Expand Down Expand Up @@ -640,7 +641,7 @@ export default defineComponent({
return this.add(files) as VueUploadItem[]
})
}

if (el.files) {
for (let i = 0; i < el.files.length; i++) {
const file: File = el.files[i]
Expand Down Expand Up @@ -712,12 +713,12 @@ export default defineComponent({
return Promise.resolve([])
},

// 获得 entrys

// 获得 entrys
getFileSystemEntry(entry: Array<File | FileSystemFileEntry | FileSystemDirectoryEntry> | File | FileSystemFileEntry | FileSystemDirectoryEntry, path = ''): Promise<VueUploadItem[]> {
return new Promise((resolve) => {
const maximumValue = this.iMaximum

if (!entry) {
resolve([])
return
Expand All @@ -737,7 +738,7 @@ export default defineComponent({
})
}
forEach(0)
return
return
}

if (entry instanceof Blob) {
Expand All @@ -753,8 +754,8 @@ export default defineComponent({
return
}



if (entry.isFile) {
entry.file(function (file) {
resolve([
Expand All @@ -769,7 +770,7 @@ export default defineComponent({
})
return
}

if (entry.isDirectory && this.dropDirectory) {
const uploadFiles: VueUploadItem[] = []
// 目录也要添加到文件列表
Expand Down Expand Up @@ -1068,7 +1069,7 @@ export default defineComponent({
}
speedTime = speedTime2


file = this.update(file, {
progress: (e.loaded / e.total * 100).toFixed(2),
speed: e.loaded - speedLoaded,
Expand Down Expand Up @@ -1186,7 +1187,7 @@ export default defineComponent({
// 更新
// @ts-ignore
file = this.update(file, data)

if (!file) {
return reject(new Error('abort'))
}
Expand All @@ -1208,7 +1209,7 @@ export default defineComponent({
xhr.onerror = fn
xhr.onabort = fn
xhr.ontimeout = fn


// 超时
if (file.timeout) {
Expand Down