Page rendering method and device, equipment and medium
By pre-injecting the mini-program page content data on the server and using a rendering thread for rendering, the problem of slow page rendering speed when the mini-program starts is solved, resulting in faster rendering speed and a better user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-11
- Publication Date
- 2026-03-13
AI Technical Summary
The slow page rendering speed when the mini program starts up results in a long period of blank screen, which affects the user experience.
By simulating the launch of the mini-program on the server, extracting page content data and pre-injecting it into the page style file, the rendering thread can directly use this data for rendering, reducing the dependence on the logic thread.
It improved page rendering speed, reduced white screen time, and enhanced user experience.
Smart Images

Figure CN121658115A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a page rendering method, apparatus, device, and medium. Background Technology
[0002] With the rapid development of mini-programs, more and more host applications (APPs) are integrating numerous mini-programs to provide users with various services and meet their diverse needs. However, currently, users often experience slow page rendering when opening mini-programs, resulting in prolonged periods of blank screens. Therefore, improving the page rendering speed of mini-programs has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a page rendering method, apparatus, device, and medium that can reduce page rendering time, improve page rendering speed, and enhance user experience.
[0004] In a first aspect, embodiments of this application provide a page rendering method, including:
[0005] In response to the launch command for the target mini-program, load the page style file of the target mini-program page;
[0006] The target mini-program page is rendered based on the page style data and pre-injected page content data in the page style file.
[0007] Secondly, embodiments of this application provide a page rendering apparatus, including:
[0008] The file loading module is used to load the page style file of the target mini-program in response to the launch command for the target mini-program;
[0009] The page rendering module is used to render the target mini-program page based on the page style data and pre-injected page content data in the page style file.
[0010] Thirdly, embodiments of this application provide an electronic device, including:
[0011] A processor and a memory, the memory being used to store a computer program, and the processor being used to invoke and run the computer program stored in the memory to perform the page rendering method as described in the foregoing first aspect embodiment and various implementations.
[0012] Fourthly, embodiments of this application provide a computer-readable storage medium for storing a computer program that causes a computer to execute the page rendering method as described in the first aspect embodiments and their implementations.
[0013] Fifthly, embodiments of this application provide a computer program product containing program instructions that, when executed on an electronic device, cause the electronic device to perform the page rendering method as described in the first aspect embodiment and its various implementations.
[0014] The technical solution disclosed in this application, in response to a launch command for a target mini-program, loads the page style file of the target mini-program page, and then renders the target mini-program page according to the page style data and pre-injected page content data in the page style file, thereby reducing page rendering time, improving page rendering speed, and enhancing user experience. Attached Figure Description
[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0016] Figure 1 An architecture diagram of an exemplary mini-program framework provided in this application embodiment;
[0017] Figure 2 A flowchart illustrating a page rendering method provided in an embodiment of this application;
[0018] Figure 3 A flowchart illustrating another page rendering method provided in this application embodiment;
[0019] Figure 4 A flowchart illustrating yet another page rendering method provided in an embodiment of this application;
[0020] Figure 5 An exemplary block diagram of a specific page rendering provided for an embodiment of this application;
[0021] Figure 6 A schematic block diagram of a page rendering apparatus provided in an embodiment of this application;
[0022] Figure 7 This is a schematic block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0023] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0025] In this application, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or solution described as "exemplary" or "for example" in this application should not be construed as being better or more advantageous than other embodiments or solutions. Specifically, the use of terms such as "exemplary" or "for example" is intended to present the relevant concepts in a specific manner.
[0026] In the description of the embodiments in this application, unless otherwise stated, "multiple" means two or more, that is, at least two. "At least one" means one or more. "Any" means any one or any several.
[0027] Figure 1 An architecture diagram of an exemplary mini-program framework provided for embodiments of this application is shown below. Figure 1 As shown, the framework of a mini-program is a dual-thread architecture, which includes a logic thread and a rendering thread. The logic thread executes the logic code written by the mini-program developer and dispatches page content data to the rendering thread for page rendering. The rendering thread renders and displays the mini-program page based on the page content data dispatched by the logic thread.
[0028] In related technologies, when a mini-program is launched by a user, it will run simultaneously. Figure 1The diagram shows the logic thread and rendering thread. However, because the basic library and logic code on the logic thread side are relatively complex, while the implementation logic of the rendering thread is relatively simple, the rendering thread is relatively idle compared to the logic thread when the mini-program is launched. In other words, the logic thread is busier, which causes the logic thread to send page content data to the rendering thread later. This results in a slow page rendering speed for the mini-program, displaying a blank screen to the user for a long time, thus affecting the user experience.
[0029] To address the aforementioned technical problems, this application provides a page rendering method, apparatus, device, and medium to solve the problem that users often encounter slow page rendering speed and prolonged blank screen state when opening mini-programs.
[0030] The technical solutions provided by the embodiments of this application will be described in detail below through some examples. The embodiments described below can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments.
[0031] Figure 2 This is a flowchart illustrating a page rendering method provided in an embodiment of this application. The page rendering method of this application embodiment can be executed by a page rendering device, which can consist of hardware and / or software and can be integrated into an electronic device. In this application, the electronic device may be, but is not limited to, smartphones, tablets, in-vehicle terminals, laptops, desktop computers, and wearable devices. Wearable devices may include smart glasses, smartwatches, smart bracelets, and head-mounted devices. It should be understood that the electronic device in this application may also be referred to as a terminal device or user device, and no limitation is made thereto.
[0032] like Figure 2 As shown, the method may include the following steps:
[0033] S101, in response to the launch command for the target mini-program, loads the page style file of the target mini-program page.
[0034] S102, Render the target mini-program page based on the page style data and pre-injected page content data in the page style file.
[0035] It should be understood that the aforementioned launch command for the target mini-program is specifically the user's command to open the target mini-program.
[0036] The target mini-program can be any mini-program integrated into the host application; there are no restrictions on it.
[0037] In this application, pre-injected page content data can be understood as page data pre-injected for rendering the target mini-program page, such as text content, graphic content, and tables in the mini-program page. Furthermore, this pre-injected page content data can include basic page rendering data and supplementary page rendering data. The basic page rendering data can be represented as initData.
[0038] The aforementioned basic page rendering data is the necessary data required for the initial rendering of a mini-program page upon startup, providing basic content or state for page display. The aforementioned supplementary page rendering data refers to the page data used to update the initial rendering result after the initial rendering based on the basic rendering data, enabling the updated mini-program page to display richer information. This supplementary page rendering data can be obtained in advance from the server, or dynamically obtained from the server through asynchronous requests or other methods; no restrictions are placed on its acquisition here.
[0039] Furthermore, the basic rendering data for the aforementioned page may include text, images, and basic configurations, such as component colors, component styles, and background colors. The supplementary rendering data for the aforementioned page may include user input data, page logic processing results, and other data, such as calculated numerical values and filtered lists.
[0040] In other words, the basic rendering data of the page in the pre-injected page content data in this application is used to provide basic rendering content for the mini-program page, so that users can see some basic content or layout when the page loads; while the supplementary rendering data of the page updates and enriches the content of the mini-program page rendered based on the basic rendering data of the page, thus obtaining the final mini-program page.
[0041] Considering that the mini-program can run on a server, this application can optionally simulate the startup of the target mini-program on the server before performing step S101. During the startup process of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page. Then, the server injects the page content data of the target mini-program into the page style file corresponding to the rendering thread of the target mini-program. This allows the subsequent rendering thread of the target mini-program to obtain the page content data from its own corresponding page style file and perform page rendering based on the page content data, without waiting for the page content data sent by the logic thread, thereby improving the page rendering speed.
[0042] The page style file of the target mini-program can be understood as the code file corresponding to the rendering thread, and this code file is specifically the page style file.
[0043] Furthermore, the aforementioned page style files may include data such as page layout and page fonts.
[0044] In the embodiments of this application, the server may be a cloud server or a physical server, etc. Considering that cloud servers have advantages over physical servers such as high availability, elastic scalability, ease of management, security and flexibility, the preferred server in this application is a cloud server.
[0045] In some optional embodiments, when any target mini-program integrated in the host application is launched by the user, that is, when the user's launch instruction for the target mini-program is received, the electronic device of this application can simultaneously run the logic thread and the rendering thread when launching the target mini-program, so as to load the logic code file corresponding to the logic thread through the logic thread, and load the page style file (page style code file) corresponding to the rendering thread through the rendering thread.
[0046] Because the page content data for rendering is pre-injected into the page style file corresponding to the rendering thread, the rendering thread can obtain this page content data from its own page style file and then perform page rendering operations based on this content data and page style data. In this way, when a user opens any mini-program, the mini-program's rendering thread does not need to wait for the page content data sent by the logic thread; it can directly perform page rendering operations based on the pre-injected page content data and page style file corresponding to the rendering thread. This improves page rendering speed and effectively solves the problem of the page remaining blank for a long time due to the mini-program's rendering thread waiting for page content data sent by the logic thread, resulting in a poor user experience.
[0047] The technical solution disclosed in this application, in response to a launch command for a target mini-program, loads the page style file of the target mini-program page, and then renders the target mini-program page according to the page style data and pre-injected page content data in the page style file, thereby reducing page rendering time, improving page rendering speed, and enhancing user experience.
[0048] The following is combined Figure 3 The page rendering method provided in the embodiments of this application will be further explained and described below. For example... Figure 3 As shown, this page rendering method may include the following steps:
[0049] S201, in response to the launch command for the target mini-program, load the page style file and the logic code file of the target mini-program page.
[0050] In some optional embodiments, when a user's instruction to open a target mini-program is received, the electronic device of this application can run the logic thread and rendering thread of the target mini-program in parallel. Furthermore, the logic thread loads the logic code file of the target mini-program page, and the rendering thread loads the page style file of the target mini-program.
[0051] S202, Render the target mini-program page based on the page style data and pre-injected page content data in the page style file.
[0052] Considering the parallel operation of logic threads and rendering threads, since the rendering thread's logic is relatively simple, it can load the page style file first compared to the logic thread. Therefore, the rendering thread can directly perform rendering operations on the target mini-program page based on the page style data and pre-injected page content data in the page style file it has loaded.
[0053] S203, extract the original page content data of the target mini-program page from the logic code file.
[0054] S204, Re-render the target mini-program page based on the original page content data of the target mini-program page.
[0055] After the rendering thread renders the target mini-program page, if the logic thread loads the logic code file, it then extracts the raw page content data used for rendering the target mini-program page from the logic code file. The logic thread then sends the extracted raw page content data to the rendering thread.
[0056] Furthermore, when the original page content data sent by the logic thread is received, the rendering thread can re-render the target mini-program page based on the received original page content data to obtain the final target mini-program page.
[0057] In some optional embodiments, the rendering thread re-renders the target mini-program page based on the received original page content data. Optionally, it determines the incremental difference data between the original page content data and the pre-injected page content data by comparing the original page content data with the pre-injected page content data. Then, the target mini-program page is re-rendered based on the incremental difference data to obtain the final target mini-program page.
[0058] In some optional embodiments, the rendering thread re-renders the rendered target mini-program page based on the incremental difference data, which may include one of the following:
[0059] In the first scenario, the incremental difference data is added to the pre-injected page content data to obtain the updated pre-injected page content data. Then, based on the updated pre-injected page content data and page style data, the target mini-program page is re-rendered.
[0060] In the second scenario, incremental rendering is performed on the target mini-program page based on the incremental difference data to achieve the purpose of re-rendering the target mini-program page.
[0061] The technical solution disclosed in this application loads the page style file of the target mini-program page in response to a launch command for the target mini-program. Then, based on the page style data and pre-injected page content data in the page style file, the target mini-program page is rendered. This reduces page rendering time, increases page rendering speed, and improves the user experience. Furthermore, after the rendering thread renders the target mini-program page based on the pre-injected page content data, it re-renders the target mini-program page based on the original page content data sent by the logic thread. This ensures that the final mini-program page displayed to the user corresponds to the page content data during the actual runtime of the mini-program, thereby improving page rendering speed and optimizing page display quality.
[0062] In some optional embodiments, considering that the pre-injected page content data may include a first type of resource data and a second type of resource data, wherein the first type of resource data may be the basic page rendering data, i.e., in itData, and the second type of resource data is the supplementary page rendering data, the page rendering method disclosed in the embodiments of this application will be specifically described when the pre-injected page content data is the first type of resource data:
[0063] like Figure 4 As shown, this page rendering method may include the following steps:
[0064] S301, in response to the launch command for the target mini-program, loads the page style file and logic code file of the target mini-program page.
[0065] Optionally, upon receiving a user's instruction to open the target mini-program, this application starts the target mini-program and simultaneously runs its corresponding logic thread and rendering thread. Then, the logic thread loads the target mini-program's page logic code file, and the rendering thread loads the target mini-program's page style file.
[0066] S302, based on the page style data and the first type of resource data in the page style file, perform the first rendering of the target mini-program page to obtain the first rendering result of the target mini-program page.
[0067] In some optional embodiments, when the rendering thread first loads the page style file, it can obtain the page style data and pre-injected first-type resource data (page basic rendering data) for rendering the page from the page style file. Then, based on the page style data and the pre-injected page basic rendering data, the rendering thread performs the first rendering of the target mini-program page, obtaining the first rendering result of the target mini-program page. The first rendering (FP) can be understood as the time when the rendering thread first draws pixels onto the screen, that is, the time when the page first undergoes a visual change on the screen. Furthermore, the first rendering focuses on the time when any pixel begins to be drawn, without requiring the content to be actually readable or meaningful.
[0068] After the rendering thread performs its initial rendering of the target mini-program page, if the logic thread loads the logic code file and extracts the raw page base rendering data for rendering the page from it, then the logic thread can send the extracted raw page base rendering data to the rendering thread. Upon receiving the raw page base rendering data from the logic thread, the rendering thread compares the raw page base rendering data with the pre-injected page base rendering data to check for differences. If differences are found, the initial rendering result is updated based on these differences; otherwise, no changes are made.
[0069] S303, based on the second type of resource data of the target mini-program page, update and render the initial rendering result of the target mini-program page to obtain the final target mini-program page.
[0070] To display a meaningful page to the user, this application, after the initial rendering or update of the target mini-program page by the rendering thread, can send a request to the logic thread to obtain supplementary rendering data. This allows the logic thread to load the second type of resource data (supplementary rendering data) and send the loaded supplementary rendering data to the rendering thread in the form of an update rendering event. The update rendering event carries the supplementary rendering data. Then, based on the supplementary rendering data corresponding to the update rendering event sent by the logic thread, the rendering thread updates and renders the initial rendering result of the target mini-program page, resulting in the final target mini-program page, which is the meaningful target mini-program page.
[0071] In some optional embodiments, the logic thread of this application loads supplementary page rendering data and sends the loaded supplementary page rendering data to the rendering thread. Specifically, the logic thread obtains the supplementary page rendering data of the target mini-program page from the server through the page loading function page.onLoad, generates an update rendering event based on the supplementary page rendering data, and then sends the update rendering event to the rendering thread. This allows the rendering thread to update the initial rendering result of the target mini-program page based on the received update rendering event, thus obtaining the final target mini-program page. The update rendering event carries the supplementary page rendering data of the target mini-program page.
[0072] The technical solution disclosed in this application loads the page style file of the target mini-program page in response to the launch command for the target mini-program, and then renders the target mini-program page according to the page style data and pre-injected page content data in the page style file, thereby reducing page rendering time, improving page rendering speed, and enhancing user experience.
[0073] To more clearly illustrate the embodiments of this application, a specific example is provided below to explain the rendering of a mini-program page. For example... Figure 5 As shown, when the electronic device of this application receives a user's instruction to open any target mini-program, it simultaneously runs a logic thread and a rendering thread to load the logic code file of the target mini-program through the logic thread and the page style file of the target mini-program through the rendering thread.
[0074] In the logic thread, App.js is the entry file for the target mini-program, containing its logic code; App.onLaunch is the initialization function, used to perform initialization operations such as setting global variables; App.onShow is the display function; Page.js is the entry file for each page, used to specify the page's initial data, lifecycle callbacks, and event handling functions; Page.initData is the page's raw basic rendering data, which is the necessary data for the page's initial display; Page.onLoad is the page loading function, used to retrieve supplementary rendering data from the server; Page.onShow is the page display function, used to perform operations needed when the page is displayed, such as implementing page transition effects; Page.onReady is the function for completing the initial page rendering; and setData is the page update function, used to update page data and views.
[0075] Because the rendering thread has a simpler implementation logic than the logic thread, it first loads the target mini-program's page style file, and then the logic thread loads the target mini-program's logic code file. Next, the rendering thread performs the initial rendering of the target mini-program page based on the page style data and pre-injected basic page rendering data in the loaded page style file, obtaining the initial rendering result. Afterwards, the rendering thread can send a request to the logic thread for supplementary page rendering data, for example, sending the initial rendering result to the page's initial rendering end function `Page.onReady` in the logic thread. This allows the logic thread to load the supplementary page rendering data from the server using the page loading function `Page.onLoad`, generate an update rendering event based on the supplementary rendering data, and then send the update rendering event to the rendering thread. When the rendering thread receives the update rendering event from the logic thread, it updates the initial rendering result based on the supplementary rendering data carried by the update rendering event, obtaining the first meaningful rendering result, which is the final target mini-program page. In this application, the first meaningful rendering result can be... Figure 5 The initial content rendering result.
[0076] The following is a reference to the appendix. Figure 6 This application describes a page rendering apparatus based on an embodiment. Figure 6 As shown, the page rendering device 400 includes a file loading module 410 and a page rendering module 420.
[0077] The file loading module 410 is used to load the page style file of the target mini-program in response to the launch command for the target mini-program.
[0078] The page rendering module 420 is used to render the target mini-program page according to the page style data and pre-injected page content data in the page style file.
[0079] In one optional implementation of this application embodiment, the page rendering device 400 further includes: a data extraction module and a re-rendering module;
[0080] The file loading module 410 is also used to load the logic code file of the target mini-program page;
[0081] The data extraction module is used to extract the original page content data of the target mini-program page from the logic code file;
[0082] The re-rendering module is used to re-render the target mini-program page based on the original page content data of the target mini-program page.
[0083] In one optional implementation of this application, a re-rendering module is specifically used to determine the incremental difference data between the original page content data and the pre-injected page content data; and to re-render the target mini-program page based on the incremental difference data.
[0084] In one optional implementation of this application, the re-rendering module is further configured to add the incremental difference data to the pre-injected page content data, and re-render the target mini-program page according to the updated pre-injected page content data and the page style data; or, to perform incremental rendering of the target mini-program page according to the incremental difference data.
[0085] In an optional implementation of this application embodiment, when the pre-injected page content data is first type of resource data, the page rendering device 400 further includes:
[0086] The initial rendering module is used to perform an initial rendering of the target mini-program page based on the page style data in the page style file and the first type of resource data, and obtain the initial rendering result of the target mini-program page;
[0087] The re-rendering module is also used to update the initial rendering result of the target mini-program page based on the second type of resource data of the target mini-program page, so as to obtain the final target mini-program page.
[0088] In one optional implementation of this application, the re-rendering module is further configured to obtain a second type of resource data of the target mini-program page from the server; generate an update rendering event based on the second type of resource data; and update the initial rendering result of the target mini-program page based on the update rendering event to obtain the final target mini-program page.
[0089] In one optional implementation of this application embodiment, the page rendering device 400 further includes: a pre-injection module;
[0090] The pre-injection module is used to simulate the launch of the target mini-program on the server; during the launch of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page; and the server injects the page content data of the target mini-program into the page style file of the target mini-program.
[0091] It should be understood that the device embodiments and the foregoing method embodiments can correspond to each other, and similar descriptions can be referred to the method embodiments. To avoid repetition, further details will not be provided here. Specifically, Figure 6 The device 400 shown can perform Figure 2The corresponding method embodiments, and the foregoing and other operations and / or functions of each module in device 400 are respectively implemented to achieve Figure 2 For the sake of brevity, the corresponding processes in each method are not described in detail here.
[0092] The apparatus 400 of this application embodiment has been described above from the perspective of functional modules in conjunction with the accompanying drawings. It should be understood that this functional module can be implemented in hardware, in software instructions, or in a combination of hardware and software modules. Specifically, the steps of the first aspect method embodiment in this application can be completed by integrated logic circuits in the processor's hardware and / or by software instructions. The steps of the first aspect method disclosed in this application embodiment can be directly embodied as being executed by a hardware decoding processor, or by a combination of hardware and software modules in the decoding processor. Optionally, the software module can be located in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, etc. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the first aspect method embodiment described above.
[0093] Figure 7 This is a schematic block diagram of an electronic device provided as an embodiment of this application. Figure 7 As shown, the electronic device 500 may include a memory 510 and a processor 520. The memory 510 stores computer programs and transmits the program code to the processor 520. In other words, the processor 520 can call and run the computer program from the memory 510 to implement the page rendering method described in the first aspect of this application embodiment.
[0094] For example, the processor 520 can be used to execute the above-described page rendering method according to instructions in the computer program.
[0095] In some optional embodiments, the above page rendering method includes:
[0096] In response to the launch command for the target mini-program, load the page style file of the target mini-program page;
[0097] The target mini-program page is rendered based on the page style data and pre-injected page content data in the page style file.
[0098] In some alternative embodiments, the method further includes:
[0099] Load the logic code file of the target mini-program page;
[0100] Extract the original page content data of the target mini-program page from the logic code file;
[0101] Based on the original page content data of the target mini-program page, the target mini-program page is re-rendered.
[0102] In some optional embodiments, re-rendering the target mini-program page based on the original page content data of the target mini-program page includes:
[0103] Determine the incremental difference data between the original page content data and the pre-injected page content data;
[0104] Based on the incremental difference data, the target mini-program page is re-rendered.
[0105] In some optional embodiments, re-rendering the target mini-program page based on the incremental difference data includes:
[0106] The incremental difference data is added to the pre-injected page content data, and the target mini-program page is re-rendered based on the updated pre-injected page content data and the page style data.
[0107] Alternatively, the target mini-program page can be incrementally rendered based on the incremental difference data.
[0108] In some optional embodiments, when the pre-injected page content data is first-type resource data, the method further includes:
[0109] Based on the page style data in the page style file and the first type of resource data, the target mini-program page is rendered for the first time to obtain the first rendering result of the target mini-program page.
[0110] Based on the second type of resource data of the target mini-program page, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0111] In some optional embodiments, updating the initial rendering result of the target mini-program page based on the second type of resource data of the target mini-program page to obtain the final target mini-program page includes:
[0112] Obtain the second type of resource data of the target mini-program page from the server;
[0113] Based on the second type of resource data, an update rendering event is generated;
[0114] Based on the update rendering event, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0115] In some alternative embodiments, the method further includes:
[0116] Simulate launching the target mini-program on the server;
[0117] During the startup process of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page;
[0118] The server injects the page content data of the target mini-program into the page style file of the target mini-program.
[0119] In some embodiments of this application, the processor 520 may include, but is not limited to:
[0120] General-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.
[0121] In some embodiments of this application, the memory 510 includes, but is not limited to:
[0122] Volatile memory and / or non-volatile memory. Non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory may be random access memory (RAM), used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDR SDRAM), Enhanced Synchronous DRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), and Direct Memory Bus RAM (DR RAM).
[0123] In some embodiments of this application, the computer program may be divided into one or more modules, which are stored in the memory 510 and executed by the processor 520 to complete the page rendering method provided in this application. The one or more modules may be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the electronic device.
[0124] like Figure 7 As shown, the electronic device 500 may further include:
[0125] Transceiver 530, which can be connected to processor 520 or memory 510.
[0126] The processor 520 can control the transceiver 530 to communicate with other devices; specifically, it can send information or data to other devices or receive information or data sent by other devices. The transceiver 530 may include a transmitter and a receiver. The transceiver 530 may further include antennas, and the number of antennas may be one or more.
[0127] It should be understood that the various components in the electronic device are connected through a bus system, which includes a data bus, a power bus, a control bus, and a status signal bus.
[0128] This application also provides a computer storage medium storing a computer program thereon, which, when executed by a computer, enables the computer to perform the page rendering method described in the first aspect above.
[0129] In some optional embodiments, the above page rendering method includes:
[0130] In response to the launch command for the target mini-program, load the page style file of the target mini-program page;
[0131] The target mini-program page is rendered based on the page style data and pre-injected page content data in the page style file.
[0132] In some alternative embodiments, the method further includes:
[0133] Load the logic code file of the target mini-program page;
[0134] Extract the original page content data of the target mini-program page from the logic code file;
[0135] Based on the original page content data of the target mini-program page, the target mini-program page is re-rendered.
[0136] In some optional embodiments, re-rendering the target mini-program page based on the original page content data of the target mini-program page includes:
[0137] Determine the incremental difference data between the original page content data and the pre-injected page content data;
[0138] Based on the incremental difference data, the target mini-program page is re-rendered.
[0139] In some optional embodiments, re-rendering the target mini-program page based on the incremental difference data includes:
[0140] The incremental difference data is added to the pre-injected page content data, and the target mini-program page is re-rendered based on the updated pre-injected page content data and the page style data.
[0141] Alternatively, the target mini-program page can be incrementally rendered based on the incremental difference data.
[0142] In some optional embodiments, when the pre-injected page content data is first-type resource data, the method further includes:
[0143] Based on the page style data in the page style file and the first type of resource data, the target mini-program page is rendered for the first time to obtain the first rendering result of the target mini-program page.
[0144] Based on the second type of resource data of the target mini-program page, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0145] In some optional embodiments, updating the initial rendering result of the target mini-program page based on the second type of resource data of the target mini-program page to obtain the final target mini-program page includes:
[0146] Obtain the second type of resource data of the target mini-program page from the server;
[0147] Based on the second type of resource data, an update rendering event is generated;
[0148] Based on the update rendering event, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0149] In some alternative embodiments, the method further includes:
[0150] Simulate launching the target mini-program on the server;
[0151] During the startup process of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page;
[0152] The server injects the page content data of the target mini-program into the page style file of the target mini-program.
[0153] This application also provides a computer program product containing program instructions that, when executed on an electronic device, cause the electronic device to perform the page rendering method described in the first aspect above.
[0154] In some optional embodiments, the above page rendering method includes:
[0155] In response to the launch command for the target mini-program, load the page style file of the target mini-program page;
[0156] The target mini-program page is rendered based on the page style data and pre-injected page content data in the page style file.
[0157] In some alternative embodiments, the method further includes:
[0158] Load the logic code file of the target mini-program page;
[0159] Extract the original page content data of the target mini-program page from the logic code file;
[0160] Based on the original page content data of the target mini-program page, the target mini-program page is re-rendered.
[0161] In some optional embodiments, re-rendering the target mini-program page based on the original page content data of the target mini-program page includes:
[0162] Determine the incremental difference data between the original page content data and the pre-injected page content data;
[0163] Based on the incremental difference data, the target mini-program page is re-rendered.
[0164] In some optional embodiments, re-rendering the target mini-program page based on the incremental difference data includes:
[0165] The incremental difference data is added to the pre-injected page content data, and the target mini-program page is re-rendered based on the updated pre-injected page content data and the page style data.
[0166] Alternatively, the target mini-program page can be incrementally rendered based on the incremental difference data.
[0167] In some optional embodiments, when the pre-injected page content data is first-type resource data, the method further includes:
[0168] Based on the page style data in the page style file and the first type of resource data, the target mini-program page is rendered for the first time to obtain the first rendering result of the target mini-program page.
[0169] Based on the second type of resource data of the target mini-program page, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0170] In some optional embodiments, updating the initial rendering result of the target mini-program page based on the second type of resource data of the target mini-program page to obtain the final target mini-program page includes:
[0171] Obtain the second type of resource data of the target mini-program page from the server;
[0172] Based on the second type of resource data, an update rendering event is generated;
[0173] Based on the update rendering event, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
[0174] In some alternative embodiments, the method further includes:
[0175] Simulate launching the target mini-program on the server;
[0176] During the startup process of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page;
[0177] The server injects the page content data of the target mini-program into the page style file of the target mini-program.
[0178] When implemented using software, it can be implemented wholly or partially as a computer program product. This computer program product includes one or more computer instructions. When these computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available media can be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., digital video discs, DVDs), or semiconductor media (e.g., solid-state drives, SSDs), etc.
[0179] Those skilled in the art will recognize that the modules and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0180] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple modules or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or modules may be electrical, mechanical, or other forms.
[0181] The modules described as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. For example, the functional modules in the various embodiments of this application may be integrated into one processing module, or each module may exist physically separately, or two or more modules may be integrated into one module.
[0182] In this application embodiment, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.
[0183] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A page rendering method, characterized in that, include: In response to the launch command for the target mini-program, load the page style file of the target mini-program page; The target mini-program page is rendered based on the page style data and pre-injected page content data in the page style file.
2. The method according to claim 1, characterized in that, The method further includes: Load the logic code file of the target mini-program page; Extract the original page content data of the target mini-program page from the logic code file; Based on the original page content data of the target mini-program page, the target mini-program page is re-rendered.
3. The method according to claim 2, characterized in that, The step of re-rendering the target mini-program page based on the original page content data of the target mini-program page includes: Determine the incremental difference data between the original page content data and the pre-injected page content data; Based on the incremental difference data, the target mini-program page is re-rendered.
4. The method according to claim 3, characterized in that, The step of re-rendering the target mini-program page based on the incremental difference data includes: The incremental difference data is added to the pre-injected page content data, and the target mini-program page is re-rendered based on the updated pre-injected page content data and the page style data. Alternatively, the target mini-program page can be incrementally rendered based on the incremental difference data.
5. The method according to claim 1, characterized in that, When the pre-injected page content data is first-type resource data, the method further includes: Based on the page style data in the page style file and the first type of resource data, the target mini-program page is rendered for the first time to obtain the first rendering result of the target mini-program page. Based on the second type of resource data of the target mini-program page, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
6. The method according to claim 5, characterized in that, The step of updating and rendering the initial rendering result of the target mini-program page based on the second type of resource data of the target mini-program page to obtain the final target mini-program page includes: Obtain the second type of resource data of the target mini-program page from the server; Based on the second type of resource data, an update rendering event is generated; Based on the update rendering event, the initial rendering result of the target mini-program page is updated and rendered to obtain the final target mini-program page.
7. The method according to claim 1, characterized in that, The method further includes: Simulate launching the target mini-program on the server; During the startup process of the target mini-program, the server extracts the page content data of the target mini-program from the logic code file of the target mini-program page; The server injects the page content data of the target mini-program into the page style file of the target mini-program.
8. A page rendering apparatus, characterized in that, include: The file loading module is used to load the page style file of the target mini-program in response to the launch command for the target mini-program; The page rendering module is used to render the target mini-program page based on the page style data and pre-injected page content data in the page style file.
9. An electronic device, characterized in that, include: A processor and a memory, the memory being used to store a computer program, the processor being used to invoke and run the computer program stored in the memory to perform the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, Used to store a computer program that causes a computer to perform the method as described in any one of claims 1 to 7.
11. A computer program product containing program instructions, characterized in that, When the program instructions are executed on the electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 1 to 7.