wongchisum / files-previewer Goto Github PK
View Code? Open in Web Editor NEW@wongchisum/files-previewer react实现附件在线预览的组件
@wongchisum/files-previewer react实现附件在线预览的组件
场景:
目前我们的线上附件地址可能存储在多个域名,前端通过传入origin参数传递域名,Nginx服务器进行解析和重定向
形如:
location /attachment {
return 301 '${arg_origin}${arg_pathname}&OSSAccessKeyId=${arg_OSSAccessKeyId}&Signature=${arg_Signature}';
}
处理后能够灵活解析到其他域名,但出现无法解析附件内容的错误
通过排查,发现window.fetch的redirect配置不太兼容,fetch的redirect无论取follow或者manual均无法处理重定向的请求。
所以采用axios替代fetch
附件预览过程中,需要增加弹窗,方便用户预览
弹窗的实现不使用新的浏览器Tab页
增加工具栏,展示附件名称和关闭按钮
pdf预览增加功能:
全屏预览
工具栏
打印
下载
目前Word预览没有实现分页效果,渲染的字体大小有错误,需要寻求比较合适的组件实现渲染
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.