Skip to content

Commit 1bd3be3

Browse files
committed
fix #410
1 parent 2a2ea88 commit 1bd3be3

15 files changed

+150
-40
lines changed

dist/vue-upload-component.js

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.part.js

Lines changed: 29 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.part.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.ssr.js

Lines changed: 29 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-upload-component.ssr.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dist/docs.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/dist/docs.js.LICENSE.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/*!
2020
* Name: vue-upload-component
2121
* Component URI: https://github.com/lian-yue/vue-upload-component#readme
22-
* Version: 3.1.1
22+
* Version: 3.1.2
2323
* Author: LianYue
2424
* License: Apache-2.0
2525
* Description: Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter
@@ -28,7 +28,7 @@
2828
/*!
2929
Name: vue-upload-component
3030
Component URI: https://github.com/lian-yue/vue-upload-component#readme
31-
Version: 3.1.0
31+
Version: 3.1.1
3232
Author: LianYue
3333
License: Apache-2.0
3434
Description: Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter

docs/dist/docs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/entry.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ class Renderer extends marked.Renderer {
2525
this.options.headers.push('')
2626
}
2727
this.options.headers.push(rawName)
28-
return '<h'
29-
+ level
30-
+ ' id="'
31-
+ this.options.headerPrefix
32-
+ parent
33-
+ rawName
34-
+ '">'
35-
+ text
36-
+ '</h'
37-
+ level
38-
+ '>\n'
28+
return '<h' +
29+
level +
30+
' id="' +
31+
this.options.headerPrefix +
32+
parent +
33+
rawName +
34+
'">' +
35+
text +
36+
'</h' +
37+
level +
38+
'>\n'
3939
}
4040
}
4141

@@ -78,7 +78,7 @@ app.use(router)
7878
router.push(window.location.hash ? window.location.hash.substr(1) : '')
7979

8080
// 载入
81-
router.isReady().then(function () {
81+
router.isReady().then(function() {
8282
app.mount('#app')
8383
})
8484

@@ -104,7 +104,7 @@ app.directive('markdown', {
104104
el.innerHTML = marked(text)
105105
let selectorList = el.querySelectorAll('a')
106106
for (let i = 0; i < selectorList.length; i++) {
107-
selectorList[i].onclick = function (e) {
107+
selectorList[i].onclick = function(e) {
108108
if (e.metaKey || e.ctrlKey || e.shiftKey) {
109109
return
110110
}
@@ -158,7 +158,7 @@ app.directive('markdown', {
158158
el.innerHTML = marked(text)
159159
let selectorList = el.querySelectorAll('a')
160160
for (let i = 0; i < selectorList.length; i++) {
161-
selectorList[i].onclick = function (e) {
161+
selectorList[i].onclick = function(e) {
162162
if (e.metaKey || e.ctrlKey || e.shiftKey) {
163163
return
164164
}
@@ -215,4 +215,4 @@ app.config.globalProperties.$formatSize = function(size) {
215215
// // router,
216216
// // i18n,
217217
// // ...App
218-
// }).$mount('#app')
218+
// }).$mount('#app')

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-upload-component",
33
"description": "Vue.js file upload component, Multi-file upload, Upload directory, Drag upload, Drag the directory, Upload multiple files at the same time, html4 (IE 9), `PUT` method, Customize the filter",
4-
"version": "3.1.1",
4+
"version": "3.1.2",
55
"author": "LianYue",
66
"scripts": {
77
"dev": "cross-env NODE_ENV=development webpack serve --hot",

src/FileUpload.vue

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ export default defineComponent({
490490
index = this.addIndex
491491
}
492492
// 遍历规范对象
493-
const addFiles: VueUploadItem[] = []
493+
let addFiles: VueUploadItem[] = []
494494
for (let i = 0; i < files.length; i++) {
495495
let file: VueUploadItem | Blob = files[i]
496496
if (this.features.html5 && file instanceof Blob) {
@@ -580,6 +580,33 @@ export default defineComponent({
580580
newFiles = this.files.concat(addFiles)
581581
}
582582
this.files = newFiles
583+
584+
585+
586+
// 读取代理后的数据
587+
let index2 = 0
588+
if (index === true || index === 0) {
589+
index2 = 0
590+
} else if (index) {
591+
if (index >= 0) {
592+
if ((index + addFiles.length) > this.files.length) {
593+
index2 = this.files.length - addFiles.length
594+
} else {
595+
index2 = index
596+
}
597+
} else {
598+
index2 = this.files.length - addFiles.length + index
599+
if (index2 < 0) {
600+
index2 = 0
601+
}
602+
}
603+
} else {
604+
index2 = this.files.length - addFiles.length
605+
}
606+
607+
addFiles = this.files.slice(index2, index2 + addFiles.length)
608+
609+
583610
// 定位
584611
for (let i = 0; i < addFiles.length; i++) {
585612
const file = addFiles[i]
@@ -823,7 +850,7 @@ export default defineComponent({
823850
update(id: VueUploadItem | string, data: {[key:string]: any}): VueUploadItem | false {
824851
const file = this.get(id)
825852
if (file) {
826-
const newFile = {
853+
let newFile = {
827854
...file,
828855
...data
829856
}
@@ -842,6 +869,8 @@ export default defineComponent({
842869
}
843870
files.splice(index, 1, newFile)
844871
this.files = files
872+
newFile = this.files[index]
873+
845874
// 删除 旧定位 写入 新定位 (已便支持修改id)
846875
delete this.maps[file.id]
847876
this.maps[newFile.id] = newFile

webpack.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ module.exports = {
145145
options: {
146146
compilerOptions: {
147147
whitespace: 'condense',
148+
compatConfig: {
149+
FEATURE_ID_A: false,
150+
FEATURE_ID_B: false
151+
152+
},
148153
},
149154
transpileOptions: {
150155
transforms: {

0 commit comments

Comments
 (0)