V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
FlowerChen
V2EX  ›  问与答

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

  •  
  •   FlowerChen · 2017-04-10 16:50:05 +08:00 · 10025 次点击
    这是一个创建于 2575 天前的主题,其中的信息可能已经有所发展或是发生改变。

    从接口 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.

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1190 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 18:09 · PVG 02:09 · LAX 11:09 · JFK 14:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.