当前位置: 首页> 教育> 幼教 > 快手直播间挂人气自助网站_软件外包公司招聘_快排seo软件_想学管理方面的培训班

快手直播间挂人气自助网站_软件外包公司招聘_快排seo软件_想学管理方面的培训班

时间:2025/8/27 11:20:22来源:https://blog.csdn.net/m0_51822639/article/details/143593479 浏览次数:0次
快手直播间挂人气自助网站_软件外包公司招聘_快排seo软件_想学管理方面的培训班
  1. vue 将后端返回的文件地址下载到本地
  • template 拿到后端返回的文件路径
<el-button link type="success" icon="Download" @click="handleDownload(file)"> 附件下载 </el-button>
  • script 里面写方法
function handleDownload(val) {const url = import.meta.env.VITE_APP_BASE_API + val  // 本地地址加文件路径const link = document.createElement('a')link.href = urllink.setAttribute('download', `附件_${new Date().getTime()}`)document.body.appendChild(link)link.click()document.body.removeChild(link)
}
  1. uniapp 将后端返回的文件地址下载到本地
  • template 拿到后端返回的文件路径
<uni-forms-item label="文件:" name="excelFilePathView"><uni-file-picker fileMediatype="all" v-model="form.excelFilePathView" @select="selectFilePath" /><view v-for="(file,index) in form.excelFilePathView" :key="index"><a style="color:#00aaff" :href="file.url" target="_blank"> 查看 {{ index+1 }}</a></view>
</uni-forms-item>
  • script 里面写方法
selectFilePath(e) {const tempFilePaths = e.tempFilePathsconst imgUrl = tempFilePaths[0]uni.uploadFile({url: config.baseUrl + "/common/upload",filePath: imgUrl,name: 'file',header: {"Authorization": 'Bearer ' + getToken()},success: (uploadFileRes) => {let path = JSON.parse(uploadFileRes.data)this.form.excelFilePathView.push({name: path.fileName,url: path.fileName})}})
},
关键字:快手直播间挂人气自助网站_软件外包公司招聘_快排seo软件_想学管理方面的培训班

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: