<input type="file" @change="upData($event)" ref="InputFile" name="files" />
upData(event) { var reader = new FileReader(); let fileData = this.$refs.InputFile.files[0]; reader.readAsDataURL(fileData); let _this=this; reader.onload = function(e) { console.log(e) // data定义字段 _this.addimg=e.srcElement.result; }; },
原文地址:https://www.cnblogs.com/chenchenhao/p/10387388.html
时间: 2024-10-23 17:55:54