vue中微软的office online, 图片不能预览
const typeArr = ['csv', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'rtf', 'bmp', 'jpg', 'jpeg', 'png', 'tif', 'gif', 'pcx', 'tga', 'exif', 'fpx', 'svg',
'psd', 'cdr', 'pcd', 'dxf', 'ufo', 'eps', 'ai', 'raw', 'WMF', 'webp', 'avif', 'apng']
// const typeArr = ['csv', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'rtf']
let url = ''
if (typeArr.indexOf(File.fileFormat) !== -1) {
console.log(8888)
// 使用微软的office online
url = 'https://view.officeapps.live.com/op/view.aspx?src=' + File.absoUrl
} else {
console.log(999)
// url = item.absoUrl
url = 'https://view.xdocin.com/xdoc?_xdoc=' + File.absoUrl
}
console.log(url, 'url')
// window.open()居中打开
const width = 1000; const height = 800
const top = (window.screen.availHeight - height) / 2
const left = (window.screen.availWidth - width) / 2
window.open(url, '', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left)
报错如下: