@Configuration
public class MyConfigrauration implements WebMvcConfigurer { /**
* 当有请求经过【/myUpload/**】
* 访问本地文件【E/upload】
* @param registry
*/
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/myUpload/**")
.addResourceLocations("file:E:/upload/");
}
}
//文件上传成功后的钩子,response为服务端返回的值,file为当前上传的文件封装成的js对象
handleAvatarSuccess(response, file) {
console.log(response);
console.log(file);
          //访问的时候地址端口再加上请求的名字后端拦截
this.imageUrl = "http://localhost:9001/myUpload/" + response.data
if (response.flag) {
this.$message({
type: 'success',
message: response.message
});
this.formData.img = response.data;
} else {
this.$message({
type: 'error',
message: response.message
});
} },

最新文章

  1. Red Hat Linux9命令行--修改补充中
  2. Balance_01背包
  3. C#实现Dll(OCX)控件自动注册的两种方法
  4. (UVALive 7261)Xiongnu's Land 二分
  5. tomcat配置301重定向(urlRewrite URL重写)
  6. 学习Swift--属性
  7. Linux正则表达式grep与egrep
  8. 栈实现java
  9. Zookeeper分享
  10. LeetCode4. Median of Two Sorted Arrays---vector实现O(log(m+n)--- findkth
  11. xiaowuga poj3735—Training little cats(特殊操作转化为矩阵操作)
  12. babel 基本
  13. css-实现子元素垂直居中
  14. [深入Maven源代码]maven绑定命令行参数到具体插件
  15. C#.NET常见问题(FAQ)-如何修改Form不能修改窗体大小
  16. mysqldump备份脚本---待完善
  17. rpm使用方法
  18. 编译可移植的python
  19. 基于jQuery仿淘宝产品图片放大镜代码
  20. C# 获取命名空间对应的程序集位置

热门文章

  1. java RSA加密
  2. Grafana 系列文章(二):使用 Grafana Agent 和 Grafana Tempo 进行 Tracing
  3. 使用 NineData 实现备份集的实时查询
  4. 【单片机】nRF52832 实现停止蓝牙广播接口
  5. 12月13日内容总结——路由分发、名称空间、虚拟环境、视图层三板斧、JsonResponse对象、request对象获取文件、视图层FBV与CBV的源码剖析、模版层简介
  6. Arm-Linux子系统的互相Notify
  7. OpenMP Sections Construct 实现原理以及源码分析
  8. 10分钟搞定简易MVVM
  9. Spring框架-IoC核心
  10. 了解舵机以及MG996R的控制方法