Skip to content
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

WIP Features and Fixes #203

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
17 changes: 8 additions & 9 deletions src/FileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export default {
* @return {[type]} [description]
*/
mounted() {
let input = document.createElement('input')
const input = document.createElement('input')
input.type = 'file'
input.multiple = true

Expand Down Expand Up @@ -239,17 +239,16 @@ export default {
* @return {[type]} [description]
*/
uploaded() {
let file
for (let i = 0; i < this.files.length; i++) {
file = this.files[i]
const file = this.files[i]
if (file.fileObject && !file.error && !file.success) {
return false
}
}
return true
},

chunkOptions () {
chunkOptions() {
return Object.assign(CHUNK_DEFAULT_OPTIONS, this.chunk)
},

Expand Down Expand Up @@ -285,19 +284,19 @@ export default {
}
this.files = files

let oldMaps = this.maps
const oldMaps = this.maps

// 重写 maps 缓存
this.maps = {}
for (let i = 0; i < this.files.length; i++) {
let file = this.files[i]
const file = this.files[i]
this.maps[file.id] = file
}

// add, update
for (let key in this.maps) {
let newFile = this.maps[key]
let oldFile = oldMaps[key]
const newFile = this.maps[key]
const oldFile = oldMaps[key]
if (newFile !== oldFile) {
this.emitFile(newFile, oldFile)
}
Expand All @@ -317,7 +316,7 @@ export default {
// 清空
clear() {
if (this.files.length) {
let files = this.files
const files = this.files
this.files = []

// 定位
Expand Down