Merge pull request #6259 from m-meier/fix-6257
fix(FileUpload): fix broken choose button in basic mode, fixes #6257,…pull/6161/head^2
commit
d30738ba9b
|
@ -58,10 +58,7 @@
|
|||
<Message v-for="msg of messages" :key="msg" severity="error" @close="onMessageClose" :unstyled="unstyled" :pt="ptm('pcMessages')">{{ msg }}</Message>
|
||||
<Button :label="chooseButtonLabel" :class="chooseButtonClass" :style="style" :disabled="disabled" :unstyled="unstyled" @mouseup="onBasicUploaderClick" @keydown.enter="choose" @focus="onFocus" @blur="onBlur" v-bind="ptm('pcButton')">
|
||||
<template #icon="iconProps">
|
||||
<slot v-if="!hasFiles || auto" name="uploadicon">
|
||||
<component :is="uploadIcon ? 'span' : 'UploadIcon'" :class="[iconProps.class, uploadIcon]" aria-hidden="true" v-bind="ptm('pcButton')['icon']" />
|
||||
</slot>
|
||||
<slot v-else name="chooseicon">
|
||||
<slot name="chooseicon">
|
||||
<component :is="chooseIcon ? 'span' : 'PlusIcon'" :class="[iconProps.class, chooseIcon]" aria-hidden="true" v-bind="ptm('pcButton')['icon']" />
|
||||
</slot>
|
||||
</template>
|
||||
|
@ -71,7 +68,7 @@
|
|||
{{ basicFileChosenLabel }}
|
||||
</span>
|
||||
</slot>
|
||||
<input v-if="!hasFiles" ref="fileInput" type="file" :accept="accept" :disabled="disabled" :multiple="multiple" @change="onFileSelect" @focus="onFocus" @blur="onBlur" v-bind="ptm('input')" />
|
||||
<input ref="fileInput" type="file" :accept="accept" :disabled="disabled" :multiple="multiple" @change="onFileSelect" @focus="onFocus" @blur="onBlur" v-bind="ptm('input')" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -108,7 +105,7 @@ export default {
|
|||
if (this.hasFiles) this.uploader();
|
||||
},
|
||||
onBasicUploaderClick(event) {
|
||||
if (event.button === 0 && !this.hasFiles) this.$refs.fileInput.click();
|
||||
if (event.button === 0) this.$refs.fileInput.click();
|
||||
},
|
||||
onFileSelect(event) {
|
||||
if (event.type !== 'drop' && this.isIE11() && this.duplicateIEEvent) {
|
||||
|
@ -117,6 +114,10 @@ export default {
|
|||
return;
|
||||
}
|
||||
|
||||
if (this.isBasic && this.hasFiles) {
|
||||
this.files = [];
|
||||
}
|
||||
|
||||
this.messages = [];
|
||||
this.files = this.files || [];
|
||||
let files = event.dataTransfer ? event.dataTransfer.files : event.target.files;
|
||||
|
|
Loading…
Reference in New Issue