In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the React in the use of window.print () page unresponsive problem how to do, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian with you to understand.
1. Background of the question:
The window.print () page prints and the page does not respond.
Many methods on the Internet are to let _ window.location.reload (), for this solution is non-committal, refresh the page can of course solve this problem, but not advanced
Second, the cause of the problem:
Document may have been operated but not destroyed (possibly)
3. Problem solving:
Eliminate the document of the operation
Encapsulate a printFun () method
/ / the method parameter content: elements to be printed: printFun = (content) = > {var Window = window.open ("", "Page print", "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no"); var style = ""; window. [XSS _ clean] (content + style); Window.focus (); Window.document.close () / / close the output stream of document and display the selected data Window.print (); / / print the current window return Window;}
Method call: billDetails is the id of the element you currently want to print. Of course, as long as the element can be found, other methods can.
Var windows = this.print (document.getElementById ('billDetails') [xss_clean]); windows.close (); Thank you for reading this article carefully. I hope the article "what to do if the page does not respond when using window.print () in React" shared by the editor will be helpful to you. At the same time, I hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.