downloadFile http文件下载

downloadFile ^6.8

http文件下载

#请求参数

Prop Type Value Comment
url String - 需要下载的文件网络地址
header Object - headHTTP 请求的 Header,Header 中不能设置 Refererer配置
timeout Number - 超时时间,单位为毫秒

#参数代码示例

    let params = {
        url: 'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3105753044,45676271&fm=26&gp=0.jpg',
        header: {},
        timeout: 10000
    }

#接口调用示例

      let params = {url:this.url, header:this.header, timeout:this.timeout}
      this.$bridge
        .downloadFile(params)
        .then(res => {    
          this.$alert(res)
        })
        .catch(err => {
          this.$toast(err)
        })

#返回参数

  • 成功时返回
Prop Type Comment
code Number -
msg String -
relativeFilePath String 相对路径

#返回示例

{
    "code": 0,
    "msg": "success"
}
posted on 2024-12-21 14:38  AtlasLapetos  阅读(20)  评论(0)    收藏  举报