CN-115544409-B - Page processing method and device
Abstract
The application provides a page processing method and a page processing device, wherein the page processing method is applied to a client, a target application program is operated in the client, the target application program comprises a logic thread and a rendering thread, the logic thread reads a target virtual DOM tree corresponding to a current page of the target application program and generates a page rendering instruction based on the target virtual DOM tree, the page rendering instruction is sent to the rendering thread, the rendering thread responds to the page rendering instruction and renders the current page according to the target virtual DOM tree to generate a target page of the target application program, and the mode only realizes a unidirectional process of converting the virtual DOM tree into a real DOM tree to render, so that the abnormal page of the target application program can be re-rendered and restored, and the processing of page abnormality is completed.
Inventors
- Wang Zidi
- XU WANQIU
Assignees
- 恒生电子股份有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20221026
Claims (10)
- 1. A method for processing a page, the method being applied to a client, wherein a target application program is executed in the client, the target application program including a logic thread and a rendering thread, the method comprising: Under the condition that the current page of the target application program meets a page abnormal condition, the logic thread reads a target virtual DOM tree corresponding to the current page, generates a page rendering instruction based on the target virtual DOM tree, and sends the page rendering instruction to the rendering thread, wherein the logic thread caches at least one virtual DOM tree of the current page in advance, the reading of the target virtual DOM tree corresponding to the current page comprises reading of at least one virtual DOM tree of the current page, and determining a target virtual DOM tree of the current page according to a time stamp of each virtual DOM tree; and the rendering thread responds to the page rendering instruction, renders the current page according to the target virtual DOM tree, and generates a target page of the target application program.
- 2. The method of claim 1, wherein the determining the target virtual DOM tree for the current page based on the timestamp of each virtual DOM tree comprises: sorting the at least one virtual DOM tree based on the timestamp of each virtual DOM tree; and determining the virtual DOM tree with the largest time stamp as the target virtual DOM tree of the current page.
- 3. The method of claim 1, wherein the reading the target virtual DOM tree corresponding to the current page comprises: Receiving a page exception handling instruction aiming at the current page and sent by the rendering thread; And responding to the page exception processing instruction, and reading a target virtual DOM tree corresponding to the current page.
- 4. The method of claim 3, wherein prior to receiving the page exception handling instruction for the current page sent by the rendering thread, further comprising: Determining the page state of the current page, and determining the abnormal type of the page abnormal condition according to the page state, wherein the abnormal type comprises a page blank type and a page interaction non-response type; and generating a page exception handling instruction corresponding to the current page according to the exception type.
- 5. The method of any one of claims 1-4, wherein generating page rendering instructions based on the target virtual DOM tree comprises: Analyzing the target virtual DOM tree, and determining elements to be rendered of the current page; and generating a page rendering instruction corresponding to the current page according to the element to be rendered.
- 6. The method of claim 5, wherein the generating a target page of the target application program in response to the page rendering instruction by rendering the current page according to the target virtual DOM tree comprises: analyzing the page rendering instruction and constructing a real DOM tree corresponding to the target virtual DOM tree; And rendering the current page according to the real DOM tree to generate a target page of the target application program.
- 7. The method according to claim 1, characterized in that the method further comprises: The rendering thread receives interactive operation aiming at a target page, generates an interactive instruction based on the interactive operation and sends the interactive instruction to the logic thread; The logic thread responds to the interaction instruction to generate a target virtual DOM tree under the condition that the target page of the target application program is monitored to be in a normal page, acquires a reference virtual DOM tree, compares the reference virtual DOM tree with the target virtual DOM tree, and acquires a virtual DOM tree to be updated; And the rendering thread responds to the page updating instruction, updates the target page according to the virtual DOM tree to be updated, and generates an updated page of the target application program.
- 8. A page processing apparatus for use with a client in which a target application is running, the target application comprising a monitor module, a logical thread, and a rendering thread, the apparatus comprising: The monitoring module is configured to send a page processing instruction to the logic thread under the condition that the current page of the target application program is monitored to meet a page abnormal condition; The logic thread is configured to respond to the page processing instruction, read a target virtual DOM tree corresponding to the current page, generate a page rendering instruction based on the target virtual DOM tree, and send the page rendering instruction to the rendering thread, wherein the logic thread caches at least one virtual DOM tree of the current page in advance, the reading of the target virtual DOM tree corresponding to the current page comprises reading of at least one virtual DOM tree of the current page, and determining a target virtual DOM tree of the current page according to a time stamp of each virtual DOM tree; and the rendering thread is configured to respond to the page rendering instruction, render the current page according to the target virtual DOM tree and generate a target page of the target application program.
- 9. A computing device comprising a memory, a processor, and computer instructions stored on the memory and executable on the processor, wherein the processor, when executing the computer instructions, performs the steps of the method of any one of claims 1-7.
- 10. A computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the method of any one of claims 1-7.
Description
Page processing method and device Technical Field The application relates to the technical field of computers, in particular to a page processing method. The application also relates to a page processing device, a computing device and a computer readable storage medium. Background When an application loads a page, the page normally presents the page content in its entirety, and the page may respond to various interactions by the user. But in an abnormal situation, the page does not show any content, or the page can show the content of the page completely, but cannot respond to any interactive operation of the user, which phenomenon is called a white screen. After the page blank screen occurs, the user cannot normally browse the page content, and cannot execute any operation in the page, so that the normal use of the user is affected. At present, the change of the real DOM tree of the page can be monitored in real time and converted into a virtual DOM tree described by JavaScript objects, when the white screen phenomenon occurs, the recorded virtual DOM tree is converted back to the real DOM tree to complete the page recovery, and because the page white screen recovery process is realized by adopting a data bidirectional conversion mode, the page white screen recovery process has a larger delay problem in consideration of the time consumption problem of network transmission, so that the white screen recovery efficiency is low and the user experience is poor. Disclosure of Invention In view of this, the embodiment of the application provides a page processing method. The present application is also directed to a page processing apparatus, a computing device, and a computer-readable storage medium that solve the above-mentioned problems occurring in the prior art. According to a first aspect of an embodiment of the present application, there is provided a page processing method applied to a client, in which a target application is run, the target application including a logic thread and a rendering thread, the method including: under the condition that the current page of the target application program meets a page abnormal condition, the logic thread reads a target virtual DOM tree corresponding to the current page, generates a page rendering instruction based on the target virtual DOM tree, and sends the page rendering instruction to the rendering thread; and the rendering thread responds to the page rendering instruction, renders the current page according to the target virtual DOM tree, and generates a target page of the target application program. According to a second aspect of an embodiment of the present application, there is provided a page processing apparatus applied to a client, in which a target application is running, the target application including a monitoring module, a logic thread, and a rendering thread, the apparatus including: The monitoring module is configured to send a page processing instruction to the logic thread under the condition that the current page of the target application program is monitored to meet a page abnormal condition; The logic thread is configured to respond to the page processing instruction, read a target virtual DOM tree corresponding to the current page, generate a page rendering instruction based on the target virtual DOM tree, and send the page rendering instruction to the rendering thread; and the rendering thread is configured to respond to the page rendering instruction, render the current page according to the target virtual DOM tree and generate a target page of the target application program. According to a third aspect of embodiments of the present application there is provided a computing device comprising a memory, a processor and computer instructions stored on the memory and executable on the processor, the processor implementing the steps of the page processing method when executing the computer instructions. According to a fourth aspect of embodiments of the present application, there is provided a computer readable storage medium storing computer instructions which, when executed by a processor, implement the steps of the page processing method. The page processing method provided by the application is applied to a client, a target application program is operated in the client, the target application program comprises a logic thread and a rendering thread, and the method comprises the steps that under the condition that the current page of the target application program meets a page abnormal condition is monitored, the logic thread reads a target virtual DOM tree corresponding to the current page, generates a page rendering instruction based on the target virtual DOM tree, and sends the page rendering instruction to the rendering thread, and the rendering thread responds to the page rendering instruction, renders the current page according to the target virtual DOM tree, and generates a target page of the target application program. The page pro