Code: Select all
<FileUpload mode="basic" name="demo[]" @change="loadTextFromFile"/>
methods: {
async parse(file) {
const reader = new FileReader();
reader.readAsText(file);
const result = await new Promise((resolve, reject) => {
reader.onload = e => {
this.$emit("load", e.target.result);
this.text = e.target.result;
resolve(reader.result)
}
})
return result
},
async loadTextFromFile(ev) {
console.log(ev)
const file = ev.target.files[0];
const a = await this.parse(file);
//const resident = d.residents;
this.$emit("onresident",a)
}
but this is not working with fileUpload however it is working if i use a simple input