In this particular component, there is an input[type=file] element. Additionally, within this field, there is an uploadFile handler that invokes the validateMessage method in an attempt to modify the error message displayed. While it appears that after changing this.error
, everything is correct, the error does not appear in the div.error
and remains empty when inspecting with vueDevtool.
View data in vueDevTools
data() {
return {error: ''}
},
methods: {
validateFile(file) {
if (! file.type.includes('video/')) {
this.error = 'wrong format';
console.log(this.error); // wrong format
}
},
uploadFile(e) {
const file = e.target.files[0];
this.validateFile(file);
},
}
<input type="file"
id="im_video"
name="im_video"
@change="uploadFile"
class="hidden">
<div class="error">
{{ error }}
</div>