admin管理员组文章数量:1028451
const onlineViewFile = (url) => {
if (url) {
// 获取文件格式
const getFileFormatFun = (getFileFormatFunUrl) => {
console.log(175555, getFileFormatFunUrl);
const getInUrl = getFileFormatFunUrl;
const urlArr = (getInUrl || '').split('/') || [];
const urlArrLast = urlArr[urlArr.length - 1] || '';
const urlArrLastArr = (urlArrLast || '').split('.') || [];
const fileFormatStr = urlArrLastArr[urlArrLastArr.length - 1] || '';
return fileFormatStr;
};
if (['doc', 'docx', 'xlsx', 'xls'].includes(getFileFormatFun(url))) {
const officeUrl = `https://view.officeapps.live/op/view.aspx?src=${url}`;
window.open(officeUrl, url, 'width=1100,height=768');
console.log(18666, officeUrl);
} else {
window.open(url, url, 'width=800,height=700');
}
} else {
console.error('缺少查看文件地址', url);
}
};
export {
onlineViewFile
}
const onlineViewFile = (url) => {
if (url) {
// 获取文件格式
const getFileFormatFun = (getFileFormatFunUrl) => {
console.log(175555, getFileFormatFunUrl);
const getInUrl = getFileFormatFunUrl;
const urlArr = (getInUrl || '').split('/') || [];
const urlArrLast = urlArr[urlArr.length - 1] || '';
const urlArrLastArr = (urlArrLast || '').split('.') || [];
const fileFormatStr = urlArrLastArr[urlArrLastArr.length - 1] || '';
return fileFormatStr;
};
if (['doc', 'docx', 'xlsx', 'xls'].includes(getFileFormatFun(url))) {
const officeUrl = `https://view.officeapps.live/op/view.aspx?src=${url}`;
window.open(officeUrl, url, 'width=1100,height=768');
console.log(18666, officeUrl);
} else {
window.open(url, url, 'width=800,height=700');
}
} else {
console.error('缺少查看文件地址', url);
}
};
export {
onlineViewFile
}
版权声明:本文标题:常见格式浏览器在线预览 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1729174262a945742.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论