You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

54 lines
1.1 KiB

<template>
<el-upload
class="upload-demo"
ref="upload"
:action="uploadFile"
:on-preview="handlePreview"
:on-remove="handleRemove"
:on-success="handleSuccess"
:file-list="fileList"
:limit="1"
name="multipartFile"
:data="fileInfo"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
</el-upload>
</template>
<script>
import { upload_UpdateFile } from '@/api/Common/Upload'
export default {
props: {
fileInfo: {
type: Object
}
},
data() {
return {
fileList: [],
uploadFile: upload_UpdateFile
}
},
created() {
this.fileList = []
this.uploadFile = upload_UpdateFile
},
methods: {
handleSuccess(event, file, fileList) {
console.log(file)
this.$emit('change', file)
},
handleRemove(file, fileList) {
console.log(file, fileList)
},
handlePreview(file) {
console.log(file)
},
submitUpload() {
console.log(this.fileInfo)
this.$refs.upload.submit()
}
}
}
</script>