美文网首页
vant上传

vant上传

作者: jesse28 | 来源:发表于2022-10-13 14:25 被阅读0次
     //文件上传
        afterRead(file) {
          console.log(file);
          this.show = true;
          let fd = new FormData();
          fd.append("file", file.file);
          axios
            .post(
              `${window.webConfig.defultJavaFilePath}/file/uploads/serviceAnnex/0`,
              fd,
              {
                headers: {
                  "Content-Type": "multipart/form-data",
                },
              }
            )
            .then((res) => {
              this.show = false;
              if (res.data.statusCode == "200") {
                let url = res.data.resMap.fileIdList[0];
                this.fileList.push({
                  fileUrl: FILE_OPEN_URL() + url,
                  fileId: url,
                  fileName: file.file.name.split(".")[0],
                  fileType:
                    file.file.name.split(".")[file.file.name.split(".").length - 1],
                  remark: "",
                });
              }
            })
            .catch((err) => {});
        },
    

    相关文章

      网友评论

          本文标题:vant上传

          本文链接:https://www.haomeiwen.com/subject/gvcczrtx.html