上传选取文件(非样式库封装)
<el-button size="small" type="primary" @click="selectFile">选择文件</el-button> <input ref="file" type="file" hidden @change="inputChange" /> <span style="padding-left:15px;">{{fileName}}</span> public selectFile() { this.$refs.file.click(); } public inputChange(e: any) { this.files = this.$refs.file.files[0]; if (e.target.value) { console.log(this.files); this.fileName = this.files.name; } }