<template><el-upload :headers="headers"action="##" :http-request="uploadServerLog"><el-buttonsize="small"type="primary">上传</el-button></el-upload></template><script>import {upload} from"@/api/terminalApplication";
exportdefault {
data() {
return {}
},
computed: {
headers() {
return {
'Authorization': 'Bearer '+this.$store.state.user.token };
}
},
methods: {
uploadServerLog(params) {
constfile=params.file;
constform=newFormData();
form.append('file', file);
upload(form).then(res=> {
console.log(res)
}).catch(err=> {
console.log(err);
});
},
}
}
</script>