上傳圖片(Element + Vue)

{
  label: "訂單資源",
  prop: "ossName",
  type: "upload",
  dataType: 'string',
  accept: "image/jpeg",
  width: "80px",
  loadText: '附件上傳中,請稍等',
  listType: 'picture-card',
  multiple: true,
  limit: 10,
  tip: '只能上傳jpg/png文件',
  propsHttp: {
    res: 'data',
    url: 'link',
  },
  rules: [{
    required: true,
    message: "請上傳圖片"
  }],
  span: 24,
  action: '/api/blade-resource/oss/endpoint/put-file',
},

後端是BladeX

/**
 * 上傳文件
 *
 * @param file 文件
 * @return ObjectStat
 */
@SneakyThrows
@PostMapping("/put-file")
public R<BladeFile> putFile(@RequestParam MultipartFile file) {
   BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
   return R.data(bladeFile);
}
發佈了41 篇原創文章 · 獲贊 9 · 訪問量 1萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章