Fix image input vue on sliders

This commit is contained in:
Jérémy Munsch 2022-06-09 09:59:06 +02:00
parent b431508e98
commit 1aafa2c3c3
No known key found for this signature in database
GPG key ID: 18361AF3BFEC0FEC
2 changed files with 11 additions and 1 deletions

View file

@ -6,7 +6,7 @@
<div class="input-group">
<button v-on:click.prevent="chooseAFile" class="btn btn-outline-secondary" type="button">{{ __('Parcourir') }}</button>
<input :id="_id" ref="actualImage" @change="changedImage" type="file" class="d-none" :name="_name" accept="image/png,image/jpeg,.svg" :aria-describedby="`Help${_id}`">
<input v-if="typeof _value === 'string'" class="d-none" :name="_name" type="text" :value="_value">
<input v-if="_pushString && typeof _value === 'string'" class="d-none" :name="_name" type="text" :value="_value">
<input v-on:click.prevent="chooseAFile" type="text" :value="_valueFileName" class="form-control rightAligned" :aria-describedby="`Help${_id}`" readonly>
<button v-if="!_required" v-on:click.prevent="removeFile" class="btn btn-outline-danger" type="button"><i class="fas fa-eraser"></i></button>
<button v-if="!_preview && _value" class="btn btn-warning" type="button" data-bs-toggle="modal" :data-bs-target="`#ModalPreview${_id}`">
@ -164,6 +164,9 @@ export default {
if(data.browseEvent !== undefined) {
this._browseEvent = data.browseEvent ? true : false
}
if(data.pushString !== undefined) {
this._pushString = data.pushString ? true : false
}
} else {
// * Init Uppon Vue component
this._id = this.id
@ -179,6 +182,7 @@ export default {
this._preview = this.preview
this._required = this.required
this._browseEvent = this.browseEvent
this._pushString = this.pushString
}
this._hasImage = false
},
@ -217,6 +221,10 @@ export default {
browseEvent: {
type: Boolean,
default: false
},
pushString: {
type: Boolean,
default: true
}
},
data() {
@ -232,6 +240,7 @@ export default {
_preview: true,
_browseEvent: false,
_pushString: false,
_rotationText: 0,
_rotationValue: 0,

View file

@ -131,6 +131,7 @@
'width' => 1400,
'height' => 630,
'value' => $slider->picture ?? '',
'pushString' => false
];
@endphp
@include('back.modules.input-error', [ 'inputName' => 'picture'])