简体   繁体   中英

How can I return a file using react? Or `npm unload` analogs for express

How can I return a file using react? In express, this is sendFile. If the file is exe, then it will be downloaded, if it is a pdf file, then it will be displayed in the browser, if the picture, then it will also be displayed. I would like to know how you can implement the same feed using react. Or, perhaps express has the same library as unload for react. So that you can track when the user leaves the page

Not the most elegant option, but effective. Use <iframe> to make the document full screen, indicate the following:

 iframe { position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM