赞
踩
参考文章:https://segmentfault.com/q/1010000010201366
前端:
<template>
<el-upload action="test" :headers="importHeaders"></el-upload>
</template>
<script>
var mytoken = localStorage.getItem('token') // 要保证取到
export default {
data () {
return {
importHeaders: {token: mytoken}
}
}
}
</script>
后端:
@PostMapping("/test") public R upload(MultipartFile file, HttpServletRequest request) { String token=request.getHeader("token"); System.out.println("获取token==="+token);
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。