实现方案

word,微软 Office Web Viewer
const url = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent('https://501351981.github.io/vue-office/examples/dist/static/test-files/test.docx')}`window.open(url) //新建窗口打开链接预览//或window.location.href = (url); //本页面内跳转链接实现预览,留页面历史记录//或location.replace(url); //本页面内跳转链接实现预览,不留页面历史记录
excel,微软 Office Web Viewer
const url = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent('http://static.shanhuxueyuan.com/demo/excel.xlsx')}`window.open(url) //新建窗口打开链接预览//或window.location.href = (url); //本页面内跳转链接实现预览,留页面历史记录//或location.replace(url); //本页面内跳转链接实现预览,不留页面历史记录
pdf,pfile的文件预览
const url = `https://view.officeapps.live.com/op/view.aspx?src=${encodeURIComponent('https://www.*********.pdf')}`window.open(url) //新建窗口打开链接预览//或window.location.href = (url); //本页面内跳转链接实现预览,留页面历史记录//或location.replace(url); //本页面内跳转链接实现预览,不留页面历史记录

vue-office库

https://www.npmjs.com/package/@vue-office/excel