except(['wire:model']) !!} x-data="{
imageUrl: '{{ $src }}',
imageFile: null,
imageInput: null,
initFileInput() {
this.imageInput = this.$el.querySelector('input[type=file]')
this.imageInput.addEventListener('change', () => {
this.imageFile = this.imageInput.files[0]
this.imageUrl = URL.createObjectURL(this.imageFile)
})
},
destroyFileInput() {
this.imageInput.removeEventListener('change')
},
remove() {
if (!confirm('Are you sure?')) return
this.imageUrl = ''
this.imageFile = null
this.imageInput.value = ''
this.$dispatch('removed')
}
}" x-init="initFileInput" x-on:destroy.window="destroyFileInput">
{{-- Show the image --}}
{{-- Show the gray box when image is not available --}}
{{-- Image file selector --}}
only([ 'wire:model']) !!}>
{{-- Upload and remove buttons --}}
Upload
Remove