Pretty basic copy/paste code for #3648

This commit is contained in:
James Cole
2020-08-14 10:12:07 +02:00
parent d4029775ec
commit a48df9ac83
6 changed files with 87 additions and 86 deletions

View File

@@ -19,53 +19,54 @@
-->
<template>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input multiple="multiple"
autocomplete="off"
:placeholder="title"
:title="title"
ref="input"
:name="name" type="file" class="form-control">
<span class="input-group-btn">
<button
v-on:click="clearAtt"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
<div class="form-group"
v-bind:class="{ 'has-error': hasError()}"
>
<div class="col-sm-12 text-sm">
{{ title }}
</div>
<div class="col-sm-12">
<div class="input-group">
<input multiple="multiple"
autocomplete="off"
:placeholder="title"
:title="title"
ref="input"
:name="name" type="file" class="form-control">
<span class="input-group-btn">
<button
v-on:click="clearAtt"
class="btn btn-default"
type="button"><i class="fa fa-trash-o"></i></button>
</span>
</div>
<ul class="list-unstyled" v-for="error in this.error">
<li class="text-danger">{{ error }}</li>
</ul>
</div>
</div>
</template>
<script>
export default {
name: "CustomAttachments",
props: {
title: String,
name: String,
error: Array
},
methods: {
clearAtt: function() {
this.$refs.input.value = '';
},
hasError: function () {
return this.error.length > 0;
},
}
}
export default {
name: "CustomAttachments",
props: {
title: String,
name: String,
error: Array
},
mounted: function () {
window.addEventListener('paste', e => {
this.$refs.input.files = e.clipboardData.files;
});
},
methods: {
clearAtt: function () {
this.$refs.input.value = '';
},
hasError: function () {
return this.error.length > 0;
},
}
}
</script>
<style scoped>
</style>