Answer the question
In order to leave comments, you need to log in
How is it "beautiful" in the component method to replace the inscription on any element?
There is a field:
....
<div class="custom-file">
<input type="file" class="custom-file-input" id="avatar" name="avatar" @change="showUploadedAvatar">
<label class="custom-file-label" for="avatar">Выберите файл</label>
</div>
....
showUploadedAvatar(event) {
var ext = $(event.target).val().match(/\.(.+)$/)[1];
if (ext == 'jpg' ||ext == 'jpeg'||ext == 'png') {
this.newAvatar = URL.createObjectURL(event.target.files[0]);
} else {
alert('Некорректный тип файла');
}
}
this.newAvatar
link is added, the variable itself is located in:data: function(){
return {
user: null,
percents: [5,10,25,50,75,100],
categories: [],
newAvatar: null,
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question