Resource loading method, device, electronic device and computer storage medium

By displaying the skeleton component on the product details page of the e-commerce website and loading resource data when it enters the visible area, the problem of long page rendering time is solved and the user experience and server efficiency are improved.

CN114661370BActive Publication Date: 2024-08-23SHANGHAI BILIBILI TECH CO LTD
View PDF 12 Cites 0 Cited by

Patent Information

Application Number
CN202210146469.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-02-17
Publication Date
2024-08-23
Estimated Expiration
2042-02-17

AI Technical Summary

Technical Problem

When existing e-commerce websites load product details page resources, they need to load a large number of resources, which causes the page rendering time to be too long and affects the user experience.

Method used

By displaying the skeleton component, the page structure is displayed to the user before the resource data is loaded, and the corresponding resource data is loaded when the skeleton component enters the visible display area. The IntersectionObserver API is used to automatically monitor the skeleton component entering the area, reducing the amount and time of resource loading, and improving the page Rendering efficiency.

Benefits of technology

It reduces the resource loading time, avoids long-term white screen or flickering of the page, gives users a natural transition experience, and minimizes server-side resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114661370B
    Figure CN114661370B
Patent Text Reader

Abstract

The present application discloses a resource loading method, device, electronic device and computer storage medium. The method includes: displaying the current page; in response to entering a visible display area, loading the corresponding skeleton component; the skeleton component is used to display the page structure to the user before the resource data is loaded; when the skeleton component and the visible display area meet the preset conditions, the resource data corresponding to the skeleton component in the visible display area is loaded; and the loaded resource data is rendered in the visible display area according to the rendering parameters and the skeleton component. This solution can reduce the amount of resource data loaded and the resource loading time by only loading the resource data corresponding to the skeleton component in the visible display area, thereby improving the page rendering efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a resource loading method, device, electronic device and computer storage medium. Background Art

[0002] At present, many e-commerce websites use lazy loading solutions when loading resources, such as scroll loading, delayed dynamic loading of components, etc. Take a product details page as an example. Generally, the product details page has a lot of content, and users may need to scroll continuously to view all the content of the product details page. Therefore, the product details page will be divided into the first screen, the second screen, the third screen, and the fourth screen.

[0003] The existing product detail page rendering solution of e-commerce websites usually starts rendering after all resources in the product detail page are loaded. With the development of e-commerce business, product detail pages are becoming more and more complex, and more and more resources need to be loaded. This will cause a lot of time to load resources when the page is opened, and the page rendering time will be longer. Summary of the invention

[0004] In view of the above problems, the present application is proposed to provide a resource loading method, device, electronic device and computer storage medium that overcome the above problems or at least partially solve the above problems.

[0005] According to one aspect of the present application, a resource loading method is provided, comprising:

[0006] Display the current page;

[0007] In response to entering the visible display area, the corresponding skeleton component is loaded; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded;

[0008] When the skeleton component and the visible display area meet a preset condition, loading resource data corresponding to the skeleton component in the visible display area;

[0009] The loaded resource data is rendered in the visible display area according to the rendering parameters and the skeleton component.

[0010] According to another aspect of the present application, a resource loading device is provided, including:

[0011] Page display module, used to display the current page;

[0012] A loading module, for loading a corresponding skeleton component in response to entering a visible display area; wherein the skeleton component is used to display a page structure to a user before resource data is loaded; when the skeleton component and the visible display area meet a preset condition, the resource data corresponding to the skeleton component in the visible display area is loaded;

[0013] The rendering module is used to render the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0014] According to another aspect of the present application, an electronic device is provided, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;

[0015] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute operations corresponding to the resource loading method described in this application.

[0016] According to another aspect of the present application, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to execute operations corresponding to the resource loading method described in the present application.

[0017] According to the resource loading method, electronic device and computer storage medium disclosed in the present application, by responding to entering the visible display area, the corresponding skeleton component is loaded. When the skeleton component and the visible display area meet the preset conditions, only the resource data corresponding to the skeleton component in the visible display area is loaded, which can reduce the amount of loaded resource data and reduce the resource loading time, thereby improving the page rendering efficiency. In addition, the skeleton component provides a basic placeholder, and when the resource data is loaded, the data display is restored through rendering, which gives the user a very natural transition and does not cause the page to be white or flickering for a long time.

[0018] Furthermore, the IntersectionObserver API provided by the browser automatically monitors whether the skeleton component enters the visible display area, without the need for frequent calculations.

[0019] Furthermore, by implementing the loading of resource data through lazy loading components, more resource data can be automatically obtained when the user scrolls the page, and the newly obtained data will not affect the display of the original data, while minimizing the resource consumption on the server side.

[0020] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0022] Figure 1 A schematic diagram of a process of a resource loading method provided according to Embodiment 1 of the present application is shown;

[0023] Figure 2 A schematic diagram showing a skeleton component about to enter a visible display area in a resource loading method provided in Embodiment 1 of the present application is shown;

[0024] Figure 3 A schematic diagram showing a skeleton component entering a visible display area in a resource loading method provided in Embodiment 1 of the present application is shown;

[0025] Figure 4 A schematic diagram showing a skeleton component entering a preset range of a visible display area in a resource loading method provided in Embodiment 1 of the present application is shown;

[0026] Figure 5 A schematic diagram of a process of a resource loading method provided according to Embodiment 2 of the present application is shown;

[0027] Figure 6 A schematic diagram showing a flow chart of a resource loading method provided according to implementation three of the present application is shown;

[0028] Figure 7 A schematic diagram of a resource loading method according to a fourth embodiment of the present application is shown;

[0029] Figure 8 A schematic diagram of the structure of a resource loading device provided according to Embodiment 5 of the present application is shown;

[0030] Fig. 9 A structural schematic diagram of an electronic device provided according to Embodiment 7 of the present application is shown. DETAILED DESCRIPTION

[0031] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0032] Embodiment 1

[0033] Figure 1 FIG. 1 shows a flow chart of a resource loading method provided according to Embodiment 1 of the present application. Figure 1 As shown, the method includes:

[0034] Step S11, display the current page.

[0035] Among them, the current page can be the product details page currently displayed on the terminal device.

[0036] Specifically, if the user operates an application software in the terminal device, the terminal device first responds to a series of trigger operations (for example, opening operations, selecting operations, etc.) of the application software by the user until the user opens the current page, and then displays the current page through the terminal device.

[0037] Step S12, in response to entering the visible display area, loading the corresponding skeleton component, wherein the skeleton component is used to display the page structure to the user before the resource data is loaded.

[0038] Step S13, when the skeleton component and the visible display area meet preset conditions, resource data corresponding to the skeleton component in the visible display area is loaded.

[0039] The preset condition may be that the skeleton component is about to enter the visible display area, or the skeleton component enters the visible display area, or the skeleton component enters a preset range of the visible display area.

[0040] Specifically, Figure 2 As shown, when the preset condition is that the skeleton component is about to enter the visible display area, this step can be implemented by the following method: pre-define a distance threshold, i.e., a preset distance, to determine whether the distance between the skeleton component of the current page of the terminal device and the outer margin of the viewport is less than the preset distance; when the distance is less than the preset distance, it is determined that the skeleton component enters the visible display area. The viewport viewport is a rectangular area related to the terminal device, the coordinate unit is a pixel related to the terminal device, and the outer margin of the viewport can be the lower boundary, upper boundary, left boundary, or right boundary of the rectangular area, which can be determined according to the sliding direction of the viewport.

[0041] like Figure 3As shown, when the preset condition is that the skeleton component enters the visible display area, that is, once the skeleton component is detected to enter the visible display area, the preset condition is met. This step can be implemented by the following method: determine whether the skeleton component of the current page of the terminal device and the viewport generate an intersection area, and when the skeleton component and the viewport generate an intersection area, determine that the skeleton component enters the visible display area.

[0042] like Figure 4 As shown, when the preset condition is that the skeleton component enters the preset range of the visible display area, this step can be implemented by the following method: pre-define a range threshold, i.e., a preset range, which can be an area, a proportion, etc., to determine the range of the intersection area generated by the skeleton component and the viewport of the current page of the terminal device, and when the range is greater than the preset range, determine that the skeleton component enters the visible display area. For example, determine the area of ​​the intersection area generated by the skeleton component and the viewport of the current page of the terminal device, and when the area is greater than the preset area threshold, determine that the skeleton component enters the visible display area; or determine the ratio of the area of ​​the intersection area generated by the skeleton component and the viewport of the current page of the terminal device to the area of ​​the viewport, and when the ratio is greater than the preset ratio threshold, determine that the skeleton component enters the visible display area.

[0043] When it is determined that the skeleton component and the visible display area meet the preset conditions, only the resource data corresponding to the skeleton component in the visible display area is loaded. The resource data includes but is not limited to js code, css code, pictures, etc. Among them, js code is code written in javascript scripting language; css code is cascading style sheets, which is a computer language encoding code used to express file styles such as HTML (an application of standard general purpose markup language) or XML (a subset of standard general purpose markup language). In addition, code resources such as js, css and image resources can be packaged into a js file. When the skeleton component (placeholder) is in a visible state, the js file is requested through the network to realize asynchronous dynamic loading of resource data.

[0044] In order to avoid long loading waiting time, the present embodiment also provides a loading method, which predefines a time parameter, namely, a preset waiting time. When the current waiting time for loading resource data is greater than the preset waiting time, it means that the loading time is too long. At this time, regardless of whether the skeleton component enters the visible display area, the loading process of the resource data is started.

[0045] Step S14, rendering the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0046] The rendering parameters may include a maximum waiting time, that is, when the current rendering waiting time is greater than the maximum waiting time, the rendering process is automatically started if rendering has not yet been performed.

[0047] The rendering parameters may also include parameters for implementing animation rendering, and rendering based on the parameters may make the rendering process more diverse.

[0048] Specifically, when entering the current page for the first time, the skeleton component needs to be displayed. Before the current page is fully rendered, the user will see a skeleton page with a simple style that depicts the general framework of the current page. Then, when the resource data corresponding to the skeleton component is loaded and rendered, the various placeholders in the skeleton component are completely replaced by the actual resources. During this process, the user will feel that the content is gradually loading and is about to be presented, which reduces the user's anxiety and makes the loading process subjectively smooth. The skeleton component needs to be gradually removed during the rendering process.

[0049] It can be seen that this embodiment uses the lazy loading component to load resource data, and can automatically obtain more resource data when the user scrolls the page, and the newly obtained data will not affect the display of the original data, while minimizing the resource consumption on the server side. In addition, the skeleton component provides a basic placeholder, and when the resource data is loaded, the data display is restored through rendering, which gives the user a very natural transition and does not cause the page to be white or flickering for a long time.

[0050] Embodiment 2

[0051] Figure 5 The figure shows a flow chart of a resource loading method provided in the second embodiment of the present application. This embodiment is further optimized on the basis of the first embodiment, that is, the IntersectionObserver API provided by the browser is used to monitor whether the skeleton component enters the visible display area. Figure 5 As shown, the method includes:

[0052] Step S21, display the current page.

[0053] Step S22, in response to entering the visible display area, loading the corresponding skeleton component; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded.

[0054] Step S23: Automatically monitor whether the skeleton component enters the visible display area through the IntersectionObserver application programming interface API.

[0055] Specifically, when the IntersectionObserver API detects that the skeleton component enters the visible display area, it is determined that the skeleton component and the visible display area meet a preset condition, and step S24 is executed.

[0056] For example, when the IntersectionObserver API detects that the skeleton component is about to enter the visible display area, or the skeleton component enters the visible display area, or the skeleton component enters the preset range of the visible display area, it is determined that the skeleton component and the visible display area meet the preset conditions. The specific implementation methods of the above three situations can be found in the relevant description of the above embodiment 1, which will not be repeated here.

[0057] Step S24, loading resource data corresponding to the skeleton components in the visible display area.

[0058] Step S25, rendering the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0059] It can be seen that this embodiment automatically monitors whether the skeleton component enters the visible display area through the IntersectionObserver API provided by the browser, and does not require frequent calculations.

[0060] Embodiment 3

[0061] Figure 6 The flowchart of a resource loading method provided according to the third embodiment of the present application is shown. This embodiment is further optimized on the basis of the above-mentioned embodiment 1, that is, loading is realized through a lazy loading component, such as Figure 6 As shown, the method includes:

[0062] Step S31, display the current page.

[0063] Step S32, in response to entering the visible display area, loading the corresponding skeleton component; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded.

[0064] Step S33, when it is detected that the current display interface of the terminal device enters the current page, the lazy loading component is loaded.

[0065] Among them, the lazy loading component is an existing component in the terminal device. It is a resource loading method that can automatically obtain more resource data when the user scrolls the page. The newly obtained resource data will not affect the display of the original resource data, while minimizing the resource consumption on the server side.

[0066] Step S34, when it is determined that the skeleton component and the visible display area meet the preset conditions, the resource data corresponding to the skeleton component in the visible display area is loaded through the lazy loading component.

[0067] Specifically, the following resource loading parameters can be predefined:

[0068] 1) timeout: preset waiting time, that is, if this time is specified, regardless of whether the skeleton component is visible or not, the resource data will be automatically loaded after this preset waiting time;

[0069] 2) viewport: the viewport where the skeleton component is located. If the skeleton component is scrolled in the page container, the viewport is the container;

[0070] 3) direction: the scrolling direction of the viewport;

[0071] 4) threshold: the preset range of the skeleton component entering the viewport;

[0072] 5) rootMargin: viewport margin.

[0073] At least one of the above loading parameters is input into the lazy loading component. The lazy loading component loads the resource data corresponding to the skeleton component in the visible display area based on the component parameters. The specific implementation method based on each parameter can be found in the relevant description in the above embodiment 1, which will not be repeated here.

[0074] Step S35, rendering the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0075] It can be seen that this embodiment realizes the loading of resource data through the lazy loading component, and can automatically obtain more resource data when the user scrolls the page, and the newly obtained data will not affect the display of the original data, while minimizing the resource consumption on the server side.

[0076] Embodiment 4

[0077] Figure 7 The flowchart of a resource loading method provided according to the fourth embodiment of the present application is shown. This embodiment is further optimized on the basis of the above embodiment, and the animation rendering effect is achieved through the lazy loading component. Figure 7 As shown, the method includes:

[0078] Step S41, display the current page.

[0079] Step S42, in response to entering the visible display area, loading the corresponding skeleton component; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded.

[0080] Step S43, when it is determined that the skeleton component and the visible display area meet the preset conditions, the resource data corresponding to the skeleton component in the visible display area is loaded.

[0081] Step S44, prepare to load the lazy loading component, which includes rendering parameters.

[0082] The rendering parameters include the maximum waiting time. When the current rendering waiting time is greater than the maximum waiting time, the rendering process is automatically started. This parameter can be defined as maxWaitingTime. In addition, the rendering parameters can also include tagName, which is the tag name of the outer container that wraps the component.

[0083] Step S45, start loading the lazy loading component, and the skeleton component starts to disappear.

[0084] Step S46, the lazy loading component renders the loaded resource data in the visible display area, and the skeleton component starts to leave.

[0085] Step S47, the skeleton component has left.

[0086] Step S48, initialization is completed and animation rendering is realized.

[0087] Regarding steps S44 to S47, five API methods can be predefined for implementation. The five API methods are as follows:

[0088] 1) before-init: prepare to load lazy loading components;

[0089] 2) init: Start loading lazy loading components, and the skeleton components begin to disappear;

[0090] 3) before-leave: the skeleton component starts to leave

[0091] 4) after-leave: the skeleton component has left

[0092] 5) after-init: Initialization is completed.

[0093] That is, step S44 is implemented by calling the before-init function, step S45 is implemented by calling the init function, step S46 is implemented by calling the before-leave function, step S47 is implemented by calling the after-leave function, and step S48 is implemented by calling the after-init function.

[0094] It can be seen that this embodiment can achieve page animation rendering through lazy loading components.

[0095] Embodiment 5

[0096] Figure 8 FIG. 1 shows a schematic diagram of a resource loading device according to Embodiment 5 of the present application. Figure 8 As shown, the device includes: a display module 51, a loading module 52 and a rendering module 53; wherein,

[0097] The display module 51 displays the current page;

[0098] The loading module 52 is used to load the corresponding skeleton component in response to entering the visible display area; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded; when the skeleton component and the visible display area meet the preset conditions, the resource data corresponding to the skeleton component in the visible display area is loaded;

[0099] The rendering module 53 is used to render the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0100] Furthermore, the loading module 52 is specifically used to: automatically monitor whether the skeleton component enters the visible display area through the IntersectionObserver application programming interface API; when the IntersectionObserver API monitors that the skeleton component enters the visible display area, determine that the skeleton component and the visible display area meet preset conditions.

[0101] Furthermore, the loading module 52 is specifically used to: determine the range of the intersection area generated by the skeleton component and the viewport; when the range is greater than a preset range, determine that the skeleton component enters the visible display area.

[0102] Furthermore, the loading module 52 is specifically used to: determine the distance between the skeleton component of the current page of the terminal device and the outer margin of the viewport; when the distance is less than a preset distance, determine that the skeleton component enters the visible display area.

[0103] Furthermore, the loading module 52 is also used to: determine the current waiting time for loading the resource data, and automatically load the resource data when the current waiting time is greater than a preset waiting time.

[0104] Furthermore, the loading module 52 is specifically used to: load a lazy loading component when it is detected that the current display interface of the terminal device enters the current page; and load resource data corresponding to the skeleton component in the visible display area through the lazy loading component.

[0105] Furthermore, the loading module 52 is specifically used to: use a preset waiting time when loading resource data, a viewport, a viewport scrolling direction, a preset range of the skeleton component entering the viewport, and an execution parameter in the viewport margin as a component parameter of the lazy loading component; the lazy loading component loads the resource data corresponding to the skeleton component in the visible display area based on the component parameter.

[0106] Furthermore, the rendering module 53 is specifically used to: determine a current rendering waiting time, and when the current rendering waiting time is greater than a maximum waiting time, automatically render the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

[0107] Furthermore, the rendering module 53 is specifically used for: preparing to load a lazy loading component, the lazy loading component including the rendering parameters; starting to load the lazy loading component, the skeleton component starts to disappear; rendering the loaded resource data in the visible display area through the lazy loading component, the skeleton component starts to leave; the skeleton component has left; initialization is completed, and animation rendering is realized.

[0108] The resource loading device described in this embodiment is used to execute the resource loading method described in the above-mentioned embodiments 1 to 4. Its working principle and technical effect are similar and will not be repeated here.

[0109] Embodiment 6

[0110] Embodiment 6 of the present application provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the resource loading method in any of the above method embodiments.

[0111] Embodiment 7

[0112] Fig. 9 The figure shows a schematic diagram of the structure of an electronic device provided according to Embodiment 8 of the present application. The specific embodiments of the present application do not limit the specific implementation of the electronic device.

[0113] like Fig. 9 As shown, the electronic device may include: a processor (processor) 602 , a communication interface (Communications Interface) 604 , a memory (memory) 606 , and a communication bus 608 .

[0114] The processor 602, the communication interface 604, and the memory 606 communicate with each other via the communication bus 608. The communication interface 604 is used to communicate with other devices such as a client or other server network elements. The processor 602 is used to execute the program 610, which can specifically execute the relevant steps in the above method embodiment.

[0115] Specifically, the program 610 may include program codes, which include computer operation instructions.

[0116] The processor 602 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or may be processors of different types, such as one or more CPUs and one or more ASICs.

[0117] The memory 606 is used to store the program 610. The memory 606 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0118] The program 610 may be specifically used to enable the processor 602 to execute the resource loading method in any of the above method embodiments.

[0119] The algorithm or display provided here are not inherently related to any specific computer, virtual system or other equipment. Various general systems can also be used together with the teaching based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the present application embodiment is not directed to any specific programming language yet. It should be understood that various programming languages ​​can be utilized to realize the content of the present application described here, and the above description of specific languages ​​is to disclose the best mode of implementation of the present application.

[0120] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0121] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the embodiments of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.

[0122] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and further may be divided into a plurality of submodules or subunits or subcomponents. All features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device so disclosed may be combined in any combination, except that at least some of such features and / or processes or units are mutually exclusive. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature that provides the same, equivalent or similar purpose.

[0123] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.

[0124] The various component embodiments of the present application may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or a digital signal processor (DSP) may be used in practice to implement some or all functions of some or all components according to the embodiments of the present application. The present application may also be implemented as a device or apparatus program (e.g., a computer program and a computer program product) for executing part or all of the methods described herein. Such a program implementing the present application may be stored on a computer-readable medium, or may be in the form of one or more signals. Such a signal may be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.

[0125] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be constructed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.

Claims

1. A resource loading method, characterized in that: include: Display the current page; In response to entering the visible display area, the corresponding skeleton component is loaded; wherein the skeleton component is used to display the page structure to the user before the resource data is loaded; Determine the distance between the skeleton component and the outer margin of the viewport, and when the distance is less than a preset distance, determine that the skeleton component and the visible display area meet a preset condition, and load the resource data corresponding to the skeleton component in the visible display area; and determine the current waiting time for loading the resource data, and when the current waiting time is greater than the preset waiting time, start the loading process of the resource data; The loaded resource data is rendered in the visible display area according to the rendering parameters and the skeleton component.

2. The method according to claim 1, characterized in that The loading of resource data corresponding to the skeleton component in the visible display area includes: When it is detected that the current display interface of the terminal device enters the current page, the lazy loading component is loaded; The resource data corresponding to the skeleton component in the visible display area is loaded by the lazy loading component.

3. The method according to claim 2, characterized in that The loading of resource data corresponding to the skeleton component in the visible display area by the lazy loading component includes: At least one of a preset waiting time when loading resource data, a viewport, a viewport scrolling direction, a preset range of the skeleton component entering the viewport, and a viewport outer margin is used as a component parameter of the lazy loading component; The lazy loading component loads resource data corresponding to the skeleton component in the visible display area based on the component parameters.

4. The method according to any one of claims 1 to 3, characterized in that: The rendering of the loaded resource data in the visible display area according to the rendering parameters and the skeleton component includes: A current rendering wait time is determined, and when the current rendering wait time is greater than a maximum wait time, the loaded resource data is automatically rendered in the visible display area according to the rendering parameters and the skeleton component.

5. The method according to any one of claims 1 to 3, characterized in that: The rendering of the loaded resource data in the visible display area according to the rendering parameters and the skeleton component includes: Prepare to load a lazy loading component, wherein the lazy loading component includes the rendering parameters; The lazy loading component starts to load, and the skeleton component starts to disappear; The lazy loading component renders the loaded resource data in the visible display area, and the skeleton component starts to leave; The skeleton assembly has left; Initialization is completed and animation rendering is realized.

6. A resource loading device, characterized in that: include: Page display module, used to display the current page; A loading module, for loading a corresponding skeleton component in response to entering a visible display area; wherein the skeleton component is used to display a page structure to a user before resource data is loaded; determining a distance between the skeleton component and an outer margin of a viewport, and when the distance is less than a preset distance, determining that the skeleton component and the visible display area meet a preset condition, and loading resource data corresponding to the skeleton component in the visible display area; and determining a current waiting time for loading the resource data, and when the current waiting time is greater than a preset waiting time, starting a loading process for the resource data; The rendering module is used to render the loaded resource data in the visible display area according to the rendering parameters and the skeleton component.

7. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to execute an operation corresponding to the resource loading method according to any one of claims 1 to 5.

8. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute an operation corresponding to the resource loading method according to any one of claims 1 to 5.

9. A computer program product, comprising at least one executable instruction, wherein the executable instruction enables a processor to execute operations corresponding to the resource loading method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Method and electronic device for automatically generating project skeleton screen under education platform

    CN109298864A

  • Page display method and device, computer equipment and readable storage medium

    CN109902248A

  • Webpage display method and device, computer device and storage medium

    CN109977333A

  • Page display method and device, electronic equipment and storage medium

    CN111737614A

  • Webpage display method and device, storage medium and electronic equipment

    CN111898056A