Search

CN-122019904-A - Page processing method and related equipment

CN122019904ACN 122019904 ACN122019904 ACN 122019904ACN-122019904-A

Abstract

The application provides a page processing method and related equipment, wherein the method comprises the steps of obtaining rendering data of a page, wherein the rendering data comprise a document object model tree, the document object model tree comprises a plurality of nodes, each node corresponds to one element in the page, operating the document object model tree to determine target elements in the page, determining skeleton screen patterns corresponding to element types of the target elements from at least one skeleton screen pattern, controlling presentation characteristics of the elements in the page by each skeleton screen pattern in the at least one skeleton screen pattern, and carrying out pattern updating on the target elements in the document object model tree according to the skeleton screen patterns corresponding to the element types to obtain rendering information of the skeleton screen of the page, wherein the rendering information is used for displaying the skeleton screen of the page, so that the skeleton screen can be generated for the page efficiently.

Inventors

  • SUO FEI

Assignees

  • 腾讯科技(深圳)有限公司

Dates

Publication Date
20260512
Application Date
20241111

Claims (12)

  1. 1. A method of page processing, the method comprising: The method comprises the steps of obtaining rendering data of a page, wherein the rendering data comprises a document object model tree, and the document object model tree comprises a plurality of nodes, and each node corresponds to an element in the page; Operating the document object model tree, and determining target elements in the page; determining a skeleton screen style corresponding to the element type of the target element from at least one skeleton screen style, wherein each skeleton screen style in the at least one skeleton screen style is used for controlling the presentation characteristics of the elements in the page; And according to the skeleton screen style corresponding to the element type, performing style updating on the target element in the document object model tree to obtain rendering information of the skeleton screen of the page, wherein the rendering information is used for displaying the skeleton screen of the page.
  2. 2. The method of claim 1, wherein the element type of the target element is a text element type, and wherein the updating the style of the target element in the document object model tree according to the skeleton screen style corresponding to the element type to obtain the rendering information of the skeleton screen of the page comprises: creating a new tag in-row element for the target element; wrapping the target element in the tag line element; adding a class name of a skeleton screen style corresponding to the element type for the element in the tag line to update the style of the target element in the document object model tree; and obtaining rendering information of the skeleton screen of the page according to the tag line elements added with the class name of the skeleton screen style corresponding to the element type and other elements in the document object model tree.
  3. 3. The method of claim 1, wherein the element type of the target element is a picture element type, and the skeleton screen style corresponding to the element type includes a first skeleton screen style and a second skeleton screen style; And performing style updating on the target element in the document object model tree according to the skeleton screen style corresponding to the element type to obtain rendering information of the skeleton screen of the page, wherein the method comprises the following steps: creating a new tag in-row element for the target element; wrapping the target element in the tag line element; adding a class name of the first skeleton screen style for the element in the tag line and adding a class name of the second skeleton screen style for the target element to realize style updating of the target element in the document object model tree; Obtaining rendering information of the skeleton screen of the page according to the tag line in which the class name of the first skeleton screen style is added, the target element in which the class name of the first skeleton screen style is added, and other elements in the document object model tree; the first skeleton screen style is used for controlling the presentation characteristic of the target element to be a first presentation characteristic, and the second skeleton screen style is used for controlling the presentation characteristic of the target element to be a second presentation characteristic.
  4. 4. The method of claim 1, wherein the element type of the target element is an icon element type, and the performing style update on the target element in the document object model tree according to the skeleton screen style corresponding to the element type to obtain rendering information of the skeleton screen of the page comprises: adding a class name of a skeleton screen style corresponding to the icon element type for the target element to realize style updating of the target element in the document object model tree; and obtaining rendering information of the skeleton screen of the page according to the target element added with the class name of the skeleton screen style corresponding to the icon element type and other elements in the document object model tree.
  5. 5. The method of any one of claims 1-4, wherein the skeletal screen of the page is displayed in a target browser, wherein the determining a skeletal screen style corresponding to an element type of the target element from at least one skeletal screen style comprises: Determining one or more skeleton screen styles compatible with the target browser from at least one skeleton screen style, wherein each skeleton screen style compatible with the target browser corresponds to different element types; and determining the skeleton screen style corresponding to the element type of the target element from one or more skeleton screen styles compatible with the target browser.
  6. 6. The method of claim 1, wherein the page is configured with a routing uniform resource locator, the obtaining rendering data for the page comprising: Acquiring a configuration logic file of the page according to the configured routing uniform resource locator; extracting elements from the configuration logic file, and constructing the document object model tree based on the extracted elements; Operating the document object model tree in a simulated browser environment, and inlining an external style sheet in the page into the page; and filtering the inline style sheets to obtain rendering data of the page.
  7. 7. The method of claim 1, wherein the method is applied to a skeleton-screen-generation plug-in for generating rendering information of a skeleton screen for the page, the method further comprising: When the framework screen generating plug-in detects that the page changes, updated rendering data of the changed page are obtained; And updating the rendering information of the skeleton screen of the page according to the updated rendering data to obtain updated rendering information of the skeleton screen.
  8. 8. The method of claim 1, wherein the method further comprises: Generating a logic file of the skeleton screen according to the rendering information of the skeleton screen; Storing the logic file of the skeleton screen according to the output path of the skeleton screen, and And if error information occurs in the process of generating the rendering information of the skeleton screen, outputting prompt information, wherein the prompt information is used for prompting the error information and the position where the error information occurs.
  9. 9. A page processing apparatus, the apparatus comprising: The system comprises an acquisition unit, a rendering unit and a processing unit, wherein the acquisition unit is used for acquiring rendering data of a page, and the rendering data comprises a document object model tree, wherein the document object model tree comprises a plurality of nodes, and each node corresponds to one element in the page; The processing unit is used for operating the document object model tree and determining target elements in the page; the processing unit is further used for determining a skeleton screen style corresponding to the element type of the target element from at least one skeleton screen style, wherein each skeleton screen style in the at least one skeleton screen style is used for controlling the presentation characteristics of the elements in the page; The processing unit is further configured to perform style update on the target element in the document object model tree according to the skeleton screen style corresponding to the element type, so as to obtain rendering information of the skeleton screen of the page, where the rendering information is used to display the skeleton screen of the page.
  10. 10. A computer device, comprising: a processor adapted to execute a computer program; A computer readable storage medium having a computer program stored therein, which when executed by the processor, performs the page processing method of any of claims 1-8.
  11. 11. A computer-readable storage medium, characterized in that the computer storage medium stores a computer program which, when executed by a processor, performs the page processing method of any of claims 1-8.
  12. 12. A computer program product, characterized in that the computer program product comprises a computer program which, when executed by a processor, implements the page processing method of any of claims 1-8.

Description

Page processing method and related equipment Technical Field The application relates to the technical field of Internet, in particular to a page processing method and related equipment. Background On the mobile terminal or the pc terminal, because the interface is loaded for too long, the user experience is very poor, and therefore, a set of skeleton screens are provided in the loading process to provide interaction of the interface. The skeleton screen refers to a general structure for displaying pages to a user before loading page data is completed. Currently, the generation of the skeleton screen mainly includes manually writing codes, performing page interception, setting of CSS (CASCADING STYLE SHEETS ) styles, and the like, and a great deal of time and effort are required. Disclosure of Invention The embodiment of the application provides a page processing method and related equipment, which can efficiently generate a skeleton screen of a page. In one aspect, an embodiment of the present application provides a page processing method, where the method includes: The method comprises the steps of obtaining rendering data of a page, wherein the rendering data comprises a document object model tree, and the document object model tree comprises a plurality of nodes, and each node corresponds to one element in the page; Operating a document object model tree, and determining target elements in a page; Determining a skeleton screen style corresponding to the element type of the target element from at least one skeleton screen style, wherein each skeleton screen style in the at least one skeleton screen style is used for controlling the presentation characteristics of the elements in the page; And according to the skeleton screen style corresponding to the element type, carrying out style updating on the target element in the document object model tree to obtain rendering information of the skeleton screen of the page, wherein the rendering information is used for displaying the skeleton screen of the page. In one aspect, an embodiment of the present application provides a page processing apparatus, including: the system comprises an acquisition unit, a rendering unit and a processing unit, wherein the acquisition unit is used for acquiring rendering data of a page, and the rendering data comprises a document object model tree, wherein the document object model tree comprises a plurality of nodes, and each node corresponds to one element in the page; The processing unit is used for operating the document object model tree and determining target elements in the page; The processing unit is also used for determining a skeleton screen style corresponding to the element type of the target element from at least one skeleton screen style, wherein each skeleton screen style in the at least one skeleton screen style is used for controlling the presentation characteristics of the elements in the page; The processing unit is further used for carrying out style updating on target elements in the document object model tree according to the skeleton screen styles corresponding to the element types to obtain rendering information of the skeleton screen of the page, wherein the rendering information is used for displaying the skeleton screen of the page. The processing unit is used for carrying out style updating on the target element in the document object model tree according to the skeleton screen style corresponding to the element type to obtain the rendering information of the skeleton screen of the page, and can be specifically used for: creating a new tag in-row element for the target element; wrapping the target element in the tag line; adding class names of skeleton screen styles corresponding to element types for elements in a tag line to update styles of target elements in a document object model tree; and obtaining rendering information of the skeleton screen of the page according to the tag line elements added with the class name of the skeleton screen style corresponding to the element type and other elements in the document object model tree. The element types of the target elements are picture element types, and the skeleton screen styles corresponding to the element types comprise a first skeleton screen style and a second skeleton screen style; the processing unit performs style update on the target element in the document object model tree according to the skeleton screen style corresponding to the element type, and when rendering information of the skeleton screen of the page is obtained, the processing unit can be specifically used for: creating a new tag in-row element for the target element; wrapping the target element in the tag line; Adding a class name of a first skeleton screen style for the element in the tag line and a class name of a second skeleton screen style for the target element to realize style updating of the target element in the document object model tree; Obtaining rendering informati