报错:
Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed.
主要是因为 Chrome 更新后不支持这种用法(其他主流浏览器也不支持),需要改为:
link.href = window.URL.createObjectURL(new Blob([blob],{type: 'application/zip'}));
完整代码
Vue 二进制流下载文件参考代码
* 下载文件,需要为二进制文件流
* @param {*} blob 文件流
* @param {*} fileName 文件名称
* @param {*} suffix 后缀
* @param {*} type blob类型
fileUtil.downloadFile = (blob, fileName = '', suffix = '.xlsx', type) => {
fileName += suffix
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveOrOpenBlob(blob, fileName)
} else {
const link = document.createElement('a')
link.href = window.URL.createObjectURL(new Blob([blob],{type}))
link.download = fileName
link.click()
window.URL.revokeObjectURL(link.href)
swagger测试导出报URL.createObjectURL: Argument 1 is not valid for any of the 1-argument overloads.
1. 报错信息
Uncaught (in promise) TypeError: Failed to execute 'createObjectURL' on 'URL': No function was found that matched the signature provided.
window.URL.createObjectURL()在IE10, IE11中报“Error: 拒绝访问的”错误.
解决方式
const pdfData = new Blob([content], { type: ‘text/csv’ });
if (window.navigator && window.navigator.msSaveOrOpenBlob) {
window.navigator.msSaveOrOpenBlob(pdfData , file_name);
转自:https://blog.csdn.net/Miss_Liang/article/details/85781396
window.URL.createObjectURL(mediaStream) 出现 typeError 错误的原因是
浏览器正在取消对 mediaStream 类型的支持
解决方案:
video.srcObject = mediaStream
代码示例...
[INFO] Reactor Summary for demo 0.0.1-SNAPSHOT:
[INFO]
[INFO] demo ……………………………………….. FAILURE [18:18 min]
[INFO] admin-service ……………………………….. SKIPPED
[INFO] user-service ………………………………… SKIPPED
[INFO] myweb ………………………………………. SKIPPED
[INFO] ————————————————————————
[INFO]
Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed.
百度了下,是因为Chrome更新后不支持这种用法,需要改为:
let binaryData = [];
binaryData.push(blob);
但是也没有出现“TypeError: Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed”报错,而且a.download = '二维码.png’变成了a.download = ‘二维码’,也成功下载了图片。也没有“TypeError: Failed to execute ‘createObjectURL’ on ‘URL’: Overload resolution failed”这个报错了,成功下载了图片。
const binaryData = [];
binaryData.push(blob);
url = window.URL.createObjectURL(new Blob(binaryData,{type:'application/pdf;chartset=UTF-8'}));
出现cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'contourArea'
> Overload resolution failed:这种错误的解决思路。