流浪のwolf

卷帝

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

element的upload 图片上传主函数

  

复制代码
  /** 图片上传 */
    async UploadImage (event, file, filelist) {
      // 清空坐标
      this.formModel.ITEM_XY = [0, 0]
      this.imgX = 0
      this.imgY = 0
      let fd = new FormData()
      fd.append("file", file.raw) //传给后台接收的名字 file
      // 调用接口获取的线上地址
      const res = await api.baseData.uploadFiles(fd)
      this.imageUrl = res.url
      if (res.code === 200) {
        this.formModel.ITEM_IMAGE = res.url
      }
      // 生成了临时地址
      this.imageUrl = URL.createObjectURL(file.raw)
    },
复制代码

 

posted on   朱龙旭的网络  阅读(11)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· Blazor Hybrid适配到HarmonyOS系统
· 支付宝 IoT 设备入门宝典(下)设备经营篇
· 万字调研——AI生成内容检测
· 解决跨域问题的这6种方案,真香!
· 一套基于 Material Design 规范实现的 Blazor 和 Razor 通用组件库
点击右上角即可分享
微信分享提示