FlowerChen
V2EX  ›  问与答

createObjectURL 报错 Failed to execute 'createObjectURL' on 'URL':

  •  
  •   FlowerChen · Apr 10, 2017 · 10668 views
    This topic created in 3322 days ago, the information mentioned may be changed or developed.

    从接口 API 获取下载的文件 这里一个按钮 <button class="btn-right btn-export">导出数据</button> 点击时从接口下载附件 exportUrl(id){ let params={ 'task_id':id } this.$http.get('/api/v1/export',{ params:params }).then(function(data){ var a = document.createElement('a'); var url = window.URL.createObjectURL(data.data); a.href = url; a.click(); window.URL.revokeObjectURL(url); },function(err){ }) } },

    这段代码在本地运行是没有问题的,可以正常下载, 放到服务器上就出现为问题啦 提示错误: TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   942 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 19:38 · PVG 03:38 · LAX 12:38 · JFK 15:38
    ♥ Do have faith in what you're doing.