Fixed #1375 - Add "multiple" support to simple FileUpload button

pull/1391/head
Cagatay Civici 2021-07-27 11:17:21 +03:00
parent ab17ffa622
commit a5c045f2da
1 changed files with 2 additions and 2 deletions

View File

@ -34,7 +34,7 @@
<span :class="basicChooseButtonClass" @mouseup="onBasicUploaderClick" @keydown.enter="choose" @focus="onFocus" @blur="onBlur" v-ripple tabindex="0" > <span :class="basicChooseButtonClass" @mouseup="onBasicUploaderClick" @keydown.enter="choose" @focus="onFocus" @blur="onBlur" v-ripple tabindex="0" >
<span :class="basicChooseButtonIconClass"></span> <span :class="basicChooseButtonIconClass"></span>
<span class="p-button-label">{{basicChooseButtonLabel}}</span> <span class="p-button-label">{{basicChooseButtonLabel}}</span>
<input ref="fileInput" type="file" :accept="accept" :disabled="disabled" @change="onFileSelect" @focus="onFocus" @blur="onBlur" v-if="!hasFiles" /> <input ref="fileInput" type="file" :accept="accept" :disabled="disabled" :multiple="multiple" @change="onFileSelect" @focus="onFocus" @blur="onBlur" v-if="!hasFiles" />
</span> </span>
</div> </div>
</template> </template>
@ -425,7 +425,7 @@ export default {
}]; }];
}, },
basicChooseButtonLabel() { basicChooseButtonLabel() {
return this.auto ? this.chooseButtonLabel : (this.hasFiles ? this.files[0].name : this.chooseButtonLabel); return this.auto ? this.chooseButtonLabel : (this.hasFiles ? this.files.map(f => f.name).join(', ') : this.chooseButtonLabel);
}, },
hasFiles() { hasFiles() {
return this.files && this.files.length > 0; return this.files && this.files.length > 0;