<template>
<el-upload
ref="upload"
action="/api/upload"
:limit="1"
accept='.xlsx'
:on-success="uploadSuccess"
:on-error="uploadError"
>
<el-button size="small" type="primary">点击上传</el-button>
</el-upload>
</template>
<script>
export default {
methods: {
//文件上传事件
uploadSuccess(res) {
this.$refs.upload.clearFiles(); //去掉文件列表
},
uploadError(res){
console.log(res);
this.$refs.upload.clearFiles(); //去掉文件列表
}
}
}
</script>