|
1 | 1 | <template>
|
2 | 2 | <span :class="className">
|
3 | 3 | <slot></slot>
|
4 |
| - <label :for="forId"></label> |
| 4 | + <label :for="forId"></label> |
5 | 5 | <input
|
6 |
| - ref="input" |
7 |
| - type="file" |
8 |
| - :name="name" |
9 |
| - :id="forId" |
10 |
| - :accept="accept" |
11 |
| - :capture="capture" |
12 |
| - :disabled="disabled" |
13 |
| - :webkitdirectory="directory && features.directory" |
14 |
| - :allowdirs="directory && features.directory" |
15 |
| - :directory="directory && features.directory" |
16 |
| - :multiple="multiple && features.html5" |
17 |
| - @change="inputOnChange" |
18 |
| - /> |
| 6 | + v-if="!reload" |
| 7 | + ref="input" |
| 8 | + type="file" |
| 9 | + :name="name" |
| 10 | + :id="forId" |
| 11 | + :accept="accept" |
| 12 | + :capture="capture" |
| 13 | + :disabled="disabled" |
| 14 | + :webkitdirectory="directory && features.directory" |
| 15 | + :allowdirs="directory && features.directory" |
| 16 | + :directory="directory && features.directory" |
| 17 | + :multiple="multiple && features.html5" |
| 18 | + @change="inputOnChange" |
| 19 | + /> |
19 | 20 | </span>
|
20 | 21 | </template>
|
21 | 22 | <style>
|
|
51 | 52 | }
|
52 | 53 | </style>
|
53 | 54 | <script lang="ts">
|
54 |
| -import {PropType, defineComponent} from "vue"; |
| 55 | +import {PropType, defineComponent, h} from "vue"; |
55 | 56 |
|
56 | 57 | // @ts-ignore
|
57 | 58 | import ChunkUploadDefaultHandler from './chunk/ChunkUploadHandler.js'
|
@@ -82,6 +83,7 @@ export interface Data {
|
82 | 83 | uploading: number;
|
83 | 84 | features: Features;
|
84 | 85 | dropElement: null | HTMLElement;
|
| 86 | + reload: boolean; |
85 | 87 | }
|
86 | 88 |
|
87 | 89 | export interface Features {
|
@@ -318,6 +320,7 @@ export default defineComponent({
|
318 | 320 | destroy: false,
|
319 | 321 | maps: {},
|
320 | 322 | dropElement: null,
|
| 323 | + reload: false, |
321 | 324 | }
|
322 | 325 | },
|
323 | 326 | /**
|
@@ -1570,23 +1573,11 @@ export default defineComponent({
|
1570 | 1573 | }
|
1571 | 1574 | const target = e.target
|
1572 | 1575 | const reinput = (res: any) => {
|
1573 |
| - if (target.files) { |
1574 |
| - target.value = '' |
1575 |
| - if (target.files.length && !/safari/i.test(navigator.userAgent)) { |
1576 |
| - target.type = '' |
1577 |
| - target.type = 'file' |
1578 |
| - } |
1579 |
| - } else { |
1580 |
| - // ie9 fix #219 |
1581 |
| - const oldInput = document.getElementById(this.forId) as HTMLInputElement |
1582 |
| - const newInput = oldInput.cloneNode(true) as HTMLInputElement |
1583 |
| - newInput.value = '' |
1584 |
| - newInput.type = 'file' |
1585 |
| - // @ts-ignore |
1586 |
| - newInput.onChange = this.inputOnChange |
1587 |
| - oldInput.parentNode?.replaceChild(newInput, oldInput) |
1588 |
| - this.$refs.input = newInput |
1589 |
| - } |
| 1576 | + this.reload = true |
| 1577 | + // @ts-ignore |
| 1578 | + this.$nextTick(() => { |
| 1579 | + this.reload = false |
| 1580 | + }) |
1590 | 1581 | return res
|
1591 | 1582 | }
|
1592 | 1583 |
|
|
0 commit comments