Load files to into application without backend in Vue
Read file as data URL:
#!html <label class="input-group-btn"> <span class="btn btn-warning"> Find File… <input type="file" v-on:change="file_selected"> </span> </label>
Method:
file_selected(e) { var files = e.target.files || e.dataTransfer.files; if (!files) return; this.file_name = files[0].name; var reader = new FileReader(); reader.onload = (e) => { this.file = e.target.result; this.error = ""; }; reader.readAsDataURL(files[0]); },