Fixed #1375 - Add "multiple" support to simple FileUpload button
parent
ab17ffa622
commit
a5c045f2da
|
@ -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;
|
||||||
|
|
Loading…
Reference in New Issue