vue3+ts 如何下载上传华为云的数据

一。网上大多都是说把response的数据转换为base64或是blob转换url到a标签中进行下载。但是在华为云上的文件,上面的操作是视频文件是直接下载,但是显示文件损坏。或者就是在线预览。其实可以在华为云的url链接后面上一个

?response-content-type=application/octet-stream`

这样就可以让浏览器知道是要下载文件
因为华为云url链接的返回体类型就是content-type=application/octet-stream

封装为方法

export function downloadByUrlAndZdy({
   
    
     url, target = '_blank', fileName }) {
   
    
    
  if (/(iP)/g</

猜你喜欢

转载自blog.csdn.net/qq_45287575/article/details/128181818
今日推荐