Lazy loading tree optimization processing method and device for browser
By implementing the lazy loading tree optimization processing method in the browser, the cache pressure problem in the BS system caused by frequent expansion of large data resource groups is solved, and the efficient and stable operation of the system and the improvement of user experience is achieved.
Patent Information
- Application Number
- CN202411899707.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-23
- Publication Date
- 2025-05-06
AI Technical Summary
In the BS system, when the large data resource group is frequently expanded and multiple leaf resource groups are opened at the same time, the front-end cache pressure increases dramatically, resulting in the system interface being stuck or even crashed.
It provides a lazy loading tree optimization processing method for browsers, loading resources by responding to the expanded leaf resource group instruction, and determining whether the maximum expanded loading leaf resource group number is preset. If this number is exceeded, the lowest weight leaf resource group is retrieved from the browser cache Local storage, clean up the resources below it, and update its shrinkage state.
It realizes that when users continuously expand multiple leaf resource groups containing a large amount of data, the front end of the system keeps running smoothly without lag or crashes, significantly improving the user experience, and optimizes system performance through intelligent initialization and cache management strategies.
Smart Images

Figure CN119939055A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the field of data processing and related technical fields, and in particular, to a lazy loading tree optimization processing method and device suitable for use in a browser. Background Art
[0002] The Tree control of the front-end Element UI uses lazy loading technology, which allows the background to request and load the child nodes of a node only when a node is expanded, effectively improving the efficiency of large-scale data processing.
[0003] However, faced with the challenge of frequently expanding large data resource groups and opening multiple leaf resource groups at the same time, the pressure on the front-end cache increases dramatically, which can easily cause the BS system interface to freeze or even crash. Although lazy loading only loads the first level of data each time, continuously expanding large data leaf resource groups may still overload the front-end cache.
[0004] Therefore, more efficient and stable data loading and cache management strategies are urgently needed to cope with the challenges of large-scale resource trees in BS systems. Summary of the invention
[0005] The embodiments described herein provide a lazy loading tree optimization processing method, apparatus, device and storage medium for a browser to solve the problems existing in the prior art.
[0006] According to a first aspect of the present disclosure, a lazy loading tree optimization processing method for a browser is provided, comprising:
[0007] In response to an instruction to expand a leaf resource group, loading resources under the leaf resource group;
[0008] Determine whether there is a preset maximum number of leaf resource groups to be expanded and loaded;
[0009] If a maximum number of expanded leaf resource groups to be loaded is preset, then the number of currently expanded leaf resource groups is compared with the maximum number of expanded leaf resource groups to be loaded;
[0010] When the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups, the leaf resource group with the lowest weight is retrieved from the browser cache Local storage, the resources under it are cleaned up, and the contraction status of the leaf resource group with the lowest weight is updated.
[0011] In some embodiments of the present disclosure, before the step of loading the resources under the leaf resource group, the following steps are included:
[0012] Receive and parse the maximum expanded and loaded leaf resource group number setting message to obtain the maximum expanded and loaded leaf resource group number.
[0013] In some embodiments of the present disclosure, after the step of determining whether a maximum number of expanded and loaded leaf resource groups is preset, the method further includes:
[0014] If the maximum number of leaf resource groups to be expanded and loaded is not preset, the number of browser tabs is obtained through the Windows component;
[0015] According to the number of the browser tabs, dynamically calculate and set the default maximum number of expanded loaded leaf resource groups, and if the calculated result is less than or equal to 0, set it to 1;
[0016] Compare the number of leaf resource groups currently expanded with the default maximum number of leaf resource groups expanded and loaded;
[0017] If the number of currently expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, the leaf resource group with the lowest weight is retrieved from the Local storage, the resources under it are cleaned up, and the contraction status of the leaf resource group with the lowest weight is updated.
[0018] In some embodiments of the present disclosure, the default maximum number of expanded loaded leaf resource groups is dynamically calculated by the following steps:
[0019] Calculate the result of 5 minus the number of browser tabs plus 1. If the calculated result is greater than 0, set it as the default maximum number of expanded and loaded leaf resource groups; otherwise, set the default maximum number of expanded and loaded leaf resource groups to 1.
[0020] In some embodiments of the present disclosure, it further includes:
[0021] In response to the resource playback operation instruction, the front end obtains the leaf resource group ID of the operated resource from the resource tree, and the resource playback operation instruction includes: double-clicking the resource to play the video, right-clicking the resource to play the video, and dragging the resource to play the video;
[0022] Retrieve the leaf resource group ID from the MORE_USE_RESGROUPID object array of the Local Storage, and if the leaf resource group ID exists, increase its weight;
[0023] If the leaf resource group ID does not exist, add the leaf resource group ID and its weight to the MORE_USE_RESGROUPID object array;
[0024] Sort the MORE_USE_RESGROUPID object array in descending order according to weight, and update the MORE_USE_RESGROUPID in the LocalStorage;
[0025] The leaf resource group ID is stored as the last used leaf resource group ID in the LAST_USE_RESGROUPID of the Local Storage.
[0026] In some embodiments of the present disclosure, it further includes:
[0027] In response to an instruction to open a browser page containing a resource tree, the front end obtains from the Local Storage the leaf resource group ID with the largest weight in the MORE_USE_RESGROUPID object array and the leaf resource group ID last used stored in the LAST_USE_RESGROUPID;
[0028] Calling the backend interface to initialize the resource tree, and passing the obtained leaf resource group ID with the largest weight and the leaf resource group ID used last as parameters to the backend;
[0029] The backend constructs a lazy loading resource tree based on the received leaf resource group ID. The lazy loading resource tree preferentially includes the leaf resource group with the largest weight and the leaf resource group used last.
[0030] The front end receives the data of the lazy loading resource tree returned by the back end, and renders the lazy loading resource tree;
[0031] After rendering is completed, the front end automatically expands the leaf resource group with the largest weight and the leaf resource group used last.
[0032] In some embodiments of the present disclosure, it further includes:
[0033] The leaf resource group usage records in the Local Storage are cleaned up regularly, and the leaf resource group IDs and weight information thereof that have not been used for a preset time are deleted.
[0034] According to a second aspect of the present disclosure, a lazy loading tree optimization processing device for a browser is provided, comprising:
[0035] A loading module, configured to load resources under the leaf resource group in response to an instruction to expand the leaf resource group;
[0036] A judgment module, used to judge whether a maximum number of expanded and loaded leaf resource groups is preset;
[0037] A comparison module, for comparing the number of currently expanded leaf resource groups with the maximum number of expanded leaf resource groups loaded if a maximum number of expanded leaf resource groups loaded is preset;
[0038] The first processing module is used to retrieve the leaf resource group with the lowest weight from the browser cache Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight when the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups.
[0039] In some embodiments of the present disclosure, the parsing module 205 is used to receive and parse the maximum number of expanded and loaded leaf resource groups setting message to obtain the maximum number of expanded and loaded leaf resource groups.
[0040] In some embodiments of the present disclosure, it further includes:
[0041] The second processing module 206 is used to obtain the number of browser tabs through the Windows component if the maximum number of expanded and loaded leaf resource groups is not preset; dynamically calculate and set the default maximum number of expanded and loaded leaf resource groups according to the number of browser tabs, and if the calculated result is less than or equal to 0, set it to 1; compare the current number of expanded leaf resource groups with the default maximum number of expanded and loaded leaf resource groups; if the current number of expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, retrieve the leaf resource group with the lowest weight from the Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight.
[0042] In some embodiments of the present disclosure, it further includes:
[0043] The parsing module 205 is used to receive and parse the maximum expanded and loaded leaf resource group number setting message to obtain the maximum expanded and loaded leaf resource group number.
[0044] In some embodiments of the present disclosure, it further includes:
[0045] The second processing module 206 is used to obtain the number of browser tabs through the Windows component if the maximum number of expanded and loaded leaf resource groups is not preset; dynamically calculate and set the default maximum number of expanded and loaded leaf resource groups according to the number of browser tabs, and if the calculated result is less than or equal to 0, set it to 1; compare the current number of expanded leaf resource groups with the default maximum number of expanded and loaded leaf resource groups; if the current number of expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, retrieve the leaf resource group with the lowest weight from the Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight.
[0046] In some embodiments of the present disclosure, it further includes:
[0047] Calculation module 207 is used to dynamically calculate the default maximum number of expanded and loaded leaf resource groups, including: calculating the result of 5 minus the number of the browser tabs plus 1. If the calculated result is greater than 0, it is set as the default maximum number of expanded and loaded leaf resource groups; otherwise, the default maximum number of expanded and loaded leaf resource groups is set to 1.
[0048] In some embodiments of the present disclosure, it further includes:
[0049] The third processing module 208 is used to respond to the resource playback operation instruction, and the front end obtains the leaf resource group ID of the operated resource from the resource tree. The resource playback operation instruction includes: double-clicking the resource to play the video, right-clicking the resource to play the video, and dragging the resource to play the video; retrieving the leaf resource group ID from the MORE_USE_RESGROUPID object array of the Local Storage, and if the leaf resource group ID exists, increasing its weight; if the leaf resource group ID does not exist, adding the leaf resource group ID and its weight to the MORE_USE_RESGROUPID object array; sorting the MORE_USE_RESGROUPID object array in descending order according to the weight, and updating the MORE_USE_RESGROUPID in the Local Storage; storing the leaf resource group ID as the last used leaf resource group ID in the LAST_USE_RESGROUPID of the LocalStorage.
[0050] In some embodiments of the present disclosure, it further includes:
[0051] The fourth processing module 209 is used to respond to the browser page instruction of opening the resource tree, and the front end obtains the leaf resource group ID with the largest weight in the MORE_USE_RESGROUPID object array and the last used leaf resource group ID stored in the LAST_USE_RESGROUPID from the Local Storage; calls the back-end interface to initialize the resource tree, and passes the obtained leaf resource group ID with the largest weight and the last used leaf resource group ID as parameters to the back end; the back end builds a lazy loading resource tree according to the received leaf resource group ID, and the lazy loading resource tree preferentially includes the leaf resource group with the largest weight and the leaf resource group used last time; the front end receives the data of the lazy loading resource tree returned by the back end, and renders the lazy loading resource tree; after the rendering is completed, the front end automatically expands the leaf resource group with the largest weight and the leaf resource group used last time.
[0052] According to a third aspect of the present disclosure, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the steps of the method in any one of the above embodiments are implemented.
[0053] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method in any one of the above embodiments are implemented.
[0054] The lazy loading tree optimization processing method and device for browsers provided by the embodiments of the present disclosure first respond to the instruction to expand the leaf resource group and load the resources under the leaf resource group; then, determine whether there is a preset maximum expanded leaf resource group to load; then, if so, compare the current number of expanded leaf resource groups with the maximum number of expanded leaf resource groups to load; finally, when the current number of expanded leaf resource groups exceeds the maximum number of expanded leaf resource groups to load, retrieve the leaf resource group with the lowest weight from the browser cache Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight. It is achieved that when users click to expand multiple leaf resource groups containing a large amount of data continuously, the system front end can still maintain smooth operation without lag or crash, significantly improving the user experience; according to the user's preference strategy, the system can intelligently initialize and expand the leaf resource groups corresponding to the resources frequently used by the user, so that the user can quickly access the required resources; the front-end cache will automatically clean up the resources under the leaf resource groups that are not frequently used according to the preset strategy, ensuring that the front-end cache volume is always kept within a specific reasonable range, thereby optimizing system performance; the leaf resource group ID corresponding to the resource that the front-end clicks to access using the resource tree will be recorded in the local Storage, and the weight of the leaf resource group will be increased by 1, providing data support for subsequent intelligent recommendations; the front-end can control the number of leaf resource groups N that are opened at the same time, which can be configured according to actual needs or dynamically adjusted according to the number of tabs currently opened in the browser to meet the needs of different user scenarios; the front-end can also control the maximum number of leaf resource groups N that are loaded, which can also be configured or dynamically adjusted according to the number of browser tabs. When this number is exceeded, the system will automatically clean up the historical leaf resource groups to ensure the effective use of system resources and stable performance. The above technical effects jointly improve the interactive experience, response speed and effective management of system resources of the resource tree in the user interface, providing users with a more efficient and intelligent usage experience.
[0055] The above description is only an overview of the technical solution of the embodiment of the present application. In order to more clearly understand the technical means of the embodiment 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 embodiment 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
[0056] In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings of the embodiments will be briefly described below. It should be noted that the drawings described below only relate to some embodiments of the present disclosure, but are not intended to limit the present disclosure, wherein:
[0057] Figure 1 It is a flowchart of a lazy loading tree optimization processing method for a browser provided by an embodiment of the present disclosure;
[0058] Figure 2 is a schematic diagram of a resource tree provided by an example provided by the present disclosure;
[0059] Figure 3 is a schematic diagram of a resource tree provided by an example provided by the present disclosure;
[0060] Figure 4 is a flow chart of an example provided by the present disclosure;
[0061] Figure 5 is a schematic diagram of a browser cache example provided by the present disclosure;
[0062] Figure 6 is a flow chart of an example provided by the present disclosure;
[0063] Figure 7 is a flow chart of an example provided by the present disclosure;
[0064] Figure 8 It is a structural schematic diagram of a lazy loading tree optimization processing device for a browser provided by an embodiment of the present disclosure;
[0065] Fig. 9 It is a structural diagram of a computer device provided in an embodiment of the present disclosure.
[0066] In the drawings, reference numerals with the same last two digits correspond to the same elements. It should be noted that the elements in the drawings are schematic and not drawn to scale. DETAILED DESCRIPTION
[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present disclosure clearer, the technical solution of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all of the embodiments. Based on the described embodiments of the present disclosure, all other embodiments obtained by those skilled in the art without creative work also fall within the scope of protection of the present disclosure.
[0068] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase "embodiments" in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0069] The term "and / or" in this article is only a description of the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists, A and B exist at the same time, and B exists. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0070] Furthermore, in all embodiments of the present disclosure, terms such as “first” and “second” are used only to distinguish one component (or a part of a component) from another component (or another part of a component).
[0071] In the description of the present application, unless otherwise specified, "plurality" means more than two (including two), and similarly, "multiple groups" means more than two groups (including two).
[0072] Glossary:
[0073] Lazy loading of a tree means that when building tree data, node data is loaded only when needed, rather than loading all node data at once. This method can reduce unnecessary performance overhead and improve program running efficiency.
[0074] The basic principle of lazy loading tree is to only load the outermost node data during initialization, and only load the child node data of a node when the user expands it. This method is suitable for situations with large amounts of data, and can significantly reduce the initial loading time and improve the user experience.
[0075] Lazy loading tree is suitable for the following scenarios:
[0076] Large amount of data: When the tree structure contains a large amount of data, lazy loading can reduce the initial loading time and improve application performance.
[0077] Dynamic data: For scenarios where data needs to be loaded dynamically, lazy loading can load data on demand, avoiding performance issues caused by loading too much data at one time.
[0078] Implementation method of lazy loading tree: To implement lazy loading tree, you usually need to set relevant properties in the front-end framework. Taking Element-UI's el-tree component as an example, lazy loading can be implemented by setting the lazy property and binding the load function. When the user expands a node, the load function will be triggered to load the child node data of the node.
[0079] The disadvantages of lazy loading trees include: Network latency: If the network latency is high, users may experience long waiting times. User experience: Frequent asynchronous requests may lead to a poor user experience.
[0080] Applicable conditions include:
[0081] Large amount of data: When the tree structure contains a large amount of data, lazy loading can significantly improve performance. Dynamic data: For scenarios where data needs to be loaded dynamically, lazy loading can load data on demand, avoiding performance issues caused by loading too much data at one time.
[0082] The structure of lazy loading data: the bottom-level nodes are all resources, the upper level of resources are all leaf group nodes, the upper level is the middle group node, and the top-level node is the root resource group.
[0083] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0084] The lazy loading tree optimization processing method for a browser provided by the embodiments of the present disclosure is applied to a browser or an application front end.
[0085] Based on the problems existing in the existing technology, Figure 1 is a flowchart of a lazy loading tree optimization processing method for a browser provided by an embodiment of the present disclosure, such as Figure 1 As shown, the specific process of the lazy loading tree optimization processing method for browsers includes:
[0086] S110. In response to an instruction to expand a leaf resource group, load resources under the leaf resource group.
[0087] In the specific implementation process, when the user initiates an instruction to expand a leaf resource group, the system will respond quickly and load all resources under the leaf resource group.
[0088] In addition, before implementing step S110, the following steps may also be included:
[0089] S100. Receive and parse the maximum expanded and loaded leaf resource group number setting message to obtain the maximum expanded and loaded leaf resource group number.
[0090] In the specific implementation process, the system can receive and parse the maximum expansion and loading leaf resource group number setting message from the user or configuration, and obtain the maximum number of leaf resource groups that can be expanded, that is, the maximum number of leaf resource groups that can be expanded. The expansion number of leaf resource groups is controlled according to the maximum number of leaf resource groups that are expanded and loaded to avoid browser freeze or crash.
[0091] S120, determining whether a maximum number of expanded and loaded leaf resource groups is preset;
[0092] During the specific implementation process, in order to ensure that the expansion and loading operations of the resource tree do not exceed the preset range, the system will automatically check whether the maximum number of expanded and loaded leaf resource groups has been set for the user or specific scenario, thereby preventing system crashes or slow responses caused by resource overload.
[0093] S130, if a maximum number of expanded and loaded leaf resource groups is preset, comparing the number of currently expanded leaf resource groups with the maximum number of expanded and loaded leaf resource groups;
[0094] In the specific implementation process, if the system has set the maximum number of leaf resource groups that can be expanded and loaded for the user or a specific scenario, then when performing resource expansion operations, the system will first compare the number of leaf resource groups that have been expanded with the preset maximum number of leaf resource groups that can be expanded and loaded, to ensure that the expansion operation of the resource tree does not exceed the range that the system can bear.
[0095] In addition, after step S120, the following steps are included:
[0096] If the maximum number of leaf resource groups to be expanded and loaded is not preset, the number of browser tabs is obtained through the Windows component;
[0097] According to the number of the browser tabs, dynamically calculate and set the default maximum number of expanded loaded leaf resource groups, and if the calculated result is less than or equal to 0, set it to 1;
[0098] Compare the number of leaf resource groups currently expanded with the default maximum number of leaf resource groups expanded and loaded;
[0099] If the number of currently expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, the leaf resource group with the lowest weight is retrieved from the Local storage, the resources under it are cleaned up, and the contraction status of the leaf resource group with the lowest weight is updated.
[0100] Specifically, when the system does not preset the maximum number of leaf resource groups to be expanded and loaded for a user or a specific scenario, it will automatically adopt a more flexible strategy to manage the expansion and loading of resources. At this time, the system will accurately obtain the number of current browser tabs through Windows components. This data is dynamic and changes in real time, and can reflect the user's current usage environment and needs. Based on the number of browser tabs obtained, the system will use a set of intelligent algorithms to dynamically calculate the default maximum number of leaf resource groups to be expanded and loaded to ensure that resource management can match the user's current usage habits and not over-occupy system resources. It is worth noting that if the calculation result is less than or equal to 0, the system will automatically adjust it to 1 for stability and practicality considerations to ensure that at least one resource group can be expanded and loaded. Next, the system will compare the number of leaf resource groups that have been expanded with the dynamically calculated default maximum number of leaf resource groups to be expanded and loaded. If the number of leaf resource groups that are currently expanded exceeds the dynamically calculated default maximum number of leaf resource groups to be expanded and loaded, the system will immediately take action to retrieve and clean up the resources under the leaf resource group with the lowest weight from Local Storage. This operation is intended to free up system resources and ensure that other more important resources can be processed and displayed first. At the same time, the system will also update the shrinking status of these cleaned resource groups to ensure the accuracy and consistency of the user interface.
[0101] Specifically, the default maximum number of expanded loaded leaf resource groups is dynamically calculated through the following steps:
[0102] Calculate the result of 5 minus the number of browser tabs plus 1. If the calculated result is greater than 0, set it as the default maximum number of expanded and loaded leaf resource groups; otherwise, set the default maximum number of expanded and loaded leaf resource groups to 1.
[0103] Specifically, this step first obtains the number of current browser tabs, which is a real-time changing data that can accurately reflect the user's current activities on the browser. Next, the system will perform a specific calculation process: subtract the number of browser tabs from 5 (this value is set based on the balance between system resource consumption and user experience), and then add 1 to ensure that the system can still maintain a certain expansion capability in extreme cases (such as when the number of tabs is very small). After the calculation result comes out, the system will judge it. If the calculation result is greater than 0, it means that the number of current browser tabs is large, and the user may have multiple tasks or pages to process at the same time, so the system will set this calculation result as the default maximum number of expanded and loaded leaf resource groups. In this way, users can expand the corresponding number of resource groups according to their needs without being restricted by the system. However, if the calculation result is less than or equal to 0, it means that the number of current browser tabs is small, or the user may not need to process multiple tasks at the same time. In this case, in order to avoid waste of system resources and possible performance degradation, the system will set the default maximum number of expanded and loaded leaf resource groups to 1. This means that users can only expand and load one resource group at a time to ensure system stability and response speed, so that system resources are more reasonably allocated and utilized, avoiding possible resource waste and performance bottlenecks.
[0104] S140. When the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups, retrieve the leaf resource group with the lowest weight from the browser cache Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight.
[0105] During the specific implementation, when the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups preset by the system, the system will automatically trigger a series of operations to optimize resource management and improve user experience. During this process, the system will first go deep into the browser cache Local storage to comprehensively retrieve and record the weight information of all expanded leaf resource groups. The weight information is usually dynamically calculated and updated based on the user's historical access frequency, the importance of the resource, and other related factors, and it can reflect the user's preference and demand for resources. After retrieving the weights of all leaf resource groups, the system will sort them to find the leaf resource group with the lowest weight. The resource group with the lowest weight often means that the user has a low access frequency to it, or its importance is relatively low, so cleaning these resources has the least impact on the user experience. After determining the leaf resource group with the lowest weight, the system will start to clean up all resources under it. This operation includes removing resource display from the front-end interface, releasing resource occupation from memory, etc., to ensure the effective use of system resources. At the same time, in order to prevent users from finding these resources when they need them in the future, the system will retain the basic information of these resources (such as ID, name, etc.), but will mark their status as cleaned or inaccessible. Finally, the system updates the contraction status of the leaf resource group with the lowest weight to ensure the accuracy and consistency of the user interface, so that users can clearly see which resource groups have been cleaned up or contracted. The update of the contraction status is usually implemented through visual elements of the front-end interface (such as folding buttons, gray marks, etc.) so that users can quickly identify and operate. Through such a mechanism, the system can automatically clean up and optimize resources when the number of currently expanded leaf resource groups exceeds the preset limit, ensuring the stability and performance of the system.
[0106] In addition, after implementing step S140, the following steps may also be included:
[0107] S1501, in response to a resource playback operation instruction, the front end obtains the leaf resource group ID of the operated resource from the resource tree, wherein the resource playback operation instruction includes: double-clicking a resource to play a video, right-clicking a resource to play a video, and dragging a resource to play a video;
[0108] S1502, retrieving the leaf resource group ID from the MORE_USE_RESGROUPID object array of the Local Storage, and if the leaf resource group ID exists, increasing its weight;
[0109] S1503, if the leaf resource group ID does not exist, add the leaf resource group ID and its weight to the MORE_USE_RESGROUPID object array;
[0110] S1504, sorting the MORE_USE_RESGROUPID object array in descending order according to weight, and updating the MORE_USE_RESGROUPID in the Local Storage;
[0111] S1505. Store the leaf resource group ID as the last used resource group ID in LAST_USE_RESGROUPID of the Local Storage.
[0112] In the above steps, in response to the resource playback operation, the front-end obtains the resource group ID and records the user preference; updates the resource group weight through LocalStorage to achieve intelligent sorting; automatically adds and records the newly added resource group; and finally updates the commonly used and last used resource group IDs to optimize the user experience and resource access efficiency and achieve personalized resource recommendations.
[0113] In addition, after implementing step S140, the following steps may also be included:
[0114] S1601, in response to an instruction to open a browser page containing a resource tree, the front end obtains from the Local Storage the leaf resource group ID with the largest weight in the MORE_USE_RESGROUPID object array and the leaf resource group ID last used stored in the LAST_USE_RESGROUPID;
[0115] S1602, calling the backend interface to initialize the resource tree, and passing the obtained leaf resource group ID with the largest weight and the leaf resource group ID used last as parameters to the backend;
[0116] S1603: The backend constructs a lazy loading resource tree according to the received leaf resource group ID, where the lazy loading resource tree preferentially includes the leaf resource group with the largest weight and the leaf resource group used last.
[0117] S1604, the front end receives the data of the lazy loading resource tree returned by the back end, and renders the lazy loading resource tree;
[0118] S1605. After rendering is completed, the front end automatically expands the leaf resource group with the largest weight and the leaf resource group used last.
[0119] In the above steps, when you open the resource tree page, the front end obtains the user's preferred resource group ID from Local Storage, and the back end builds a lazy-loaded resource tree based on it, with the common and last-used leaf resource groups being loaded first. After the front end renders the lazy-loaded resource tree, these leaf resource groups are automatically expanded to improve user experience and access efficiency.
[0120] In addition, after implementing step S140, the following steps may also be included:
[0121] S170. Regularly clean up the leaf resource group usage records in the Local Storage, and delete the leaf resource group IDs and weight information that have not been used for more than a preset time, so as to optimize storage space and improve resource access efficiency.
[0122] The lazy loading tree optimization processing method for browsers provided by the embodiment of the present disclosure first responds to the instruction to expand the leaf resource group and loads the resources under the leaf resource group; then, it is determined whether there is a preset maximum expansion and loading leaf resource group; then, if there is, the number of leaf resource groups currently expanded is compared with the maximum number of leaf resource groups expanded and loaded; finally, when the number of leaf resource groups currently expanded exceeds the maximum number of leaf resource groups expanded and loaded, the leaf resource group with the lowest weight is retrieved from the browser cache Local storage, the resources under it are cleaned up, and the contraction state of the leaf resource group with the lowest weight is updated. When multiple data leaf resource groups are continuously expanded, the front end is smooth and free of jams; the leaf resource groups corresponding to commonly used resources are intelligently initialized and expanded; the front-end cache automatically cleans up uncommon resources to maintain a reasonable range; the resource leaf group IDs that have been visited are recorded and the weights are increased to support intelligent recommendations; the front-end can control the number of leaf resource groups N that are opened and loaded at the same time and can be configured or dynamically adjusted according to the browser tab, and the historical group is automatically cleaned up when the number exceeds the limit, ensuring the effective utilization of system resources and stable performance. The user interaction experience, response speed and resource management efficiency of the resource tree are improved.
[0123] In the tree structure, nodes are divided into two types: directories (or resource groups) and leaf nodes (or resources). When node A contains node B, we call node A a resource group (or directory), and node B, as the last leaf node, is called a resource (or node). In order to describe the tree structure more clearly, we will use resource groups and resources to identify different nodes in the tree.
[0124] In the BS (Browser / Server) system, there is a large resource tree containing tens of thousands of resource groups and hundreds of thousands of resource nodes. When loading and authorizing these resources on the browser, the following special processing is performed.
[0125] The particularity of the resource tree: the leaf resource groups of the resource tree can mount resources, but cannot mount other resource groups. Such a hierarchical structure is relatively simple and clear. Figure 2 In the example shown, the lowest level nodes in the tree structure are all resources, the upper level nodes are all leaf resource group nodes, the upper level nodes are intermediate resource group nodes, and the top level nodes are root resource groups (this attribute is maintained by the background). Figure 3In the case shown, the leaf resource group is directly mounted under the root resource group, and resources are mounted under the leaf resource group. In this case, the intermediate resource group may not appear in the tree structure.
[0126] This design makes the resource tree loading and authorization process more efficient, especially when dealing with large resource trees, which can significantly improve user experience and system performance.
[0127] The following is an example to illustrate: Figure 4 As shown in the figure, when the user clicks to expand the leaf resource group A, the front end performs the following steps:
[0128] 1. Load the resources under leaf resource group A.
[0129] 2. Determine whether the system has set a limit on the maximum number of leaf resource groups that can be expanded and loaded.
[0130] If the maximum number of leaf resource groups to be expanded and loaded is set to N:
[0131] Check whether the number of currently expanded leaf resource groups exceeds N.
[0132] If exceeded, then:
[0133] Retrieve the leaf resource group with the lowest weight from the browser cache local Storage (such as Figure 5 shown).
[0134] Clean up the resources under this leaf resource group (perform a partial cleanup of the resource tree).
[0135] Update the contraction status of the leaf resource group (perform a partial update of the resource tree).
[0136] If not, no additional action is taken.
[0137] If the maximum number of leaf resource groups to be expanded and loaded is not set:
[0138] The front end obtains the number X of current browser tabs through the Windows component.
[0139] The default maximum expansion number and maximum load number are dynamically set to (5-X+1) according to X. If the calculated result is less than or equal to 0, it is set to 1.
[0140] Check whether the number of currently expanded leaf resource groups exceeds (5-X+1).
[0141] If exceeded, then:
[0142] Retrieve the leaf resource group with the lowest weight from local Storage (such as Figure 5 shown).
[0143] Clean up the resources under this leaf resource group (perform a partial cleanup of the resource tree).
[0144] Update the contraction status of the leaf resource group (perform a partial update of the resource tree).
[0145] If not, no additional action is taken.
[0146] The above steps ensure that the resource tree is efficiently loaded and displayed in the browser, and dynamically adjusted according to user operations and system settings.
[0147] Let's take another example to illustrate that during the use of the resource tree, the user's usage habits are collected. Figure 6 As shown in the figure, when the user double-clicks a resource to play a video, right-clicks a resource to select a video to play, drags a resource to the playback area, etc., the front end obtains the leaf resource group ID where the resource is located from the resource tree. At the same time, the front end checks the `MORE_USE_RESGROUPID` object array in Local Storage to find out whether the leaf resource group ID exists.
[0148] If the leaf resource group ID is already included in the `MORE_USE_RESGROUPID` array, increase its corresponding weight value by 1.
[0149] If the leaf resource group ID does not exist in the array, add it to the `MORE_USE_RESGROUPID` array and initialize the weight to 1.
[0150] The frontend will then sort the `MORE_USE_RESGROUPID` array and rearrange it in descending order of weight. After the sorting is complete, the frontend will write the updated object array back to Local Storage to update the value of `MORE_USE_RESGROUPID`. This process completes the record of frequently used resource groups.
[0151] In addition, the front end will store the currently used leaf resource group ID in LocalStorage under the key `LAST_USE_RESGROUPID`. In this way, the last used leaf resource group information can be cached and tracked.
[0152] Through the above steps, the system can intelligently record and analyze users' usage habits, providing users with a more personalized and convenient resource access experience.
[0153] The following is another example to illustrate: Figure 7As shown in the figure, when a user opens a browser page containing a resource tree, the front end retrieves two key pieces of information from LocalStorage: one is the frequently used resource group ID (corresponding to the group ID with the largest weight in `MORE_USE_RESGROUPID`), and the other is the resource group ID used last time (corresponding to `LAST_USE_RESGROUPID`). Subsequently, the front end calls the back end's initialization resource tree interface and passes these two IDs to the back end as parameters.
[0154] After receiving these parameters, the backend will build a lazy-loaded resource tree based on the resource group ID with the highest weight and the resource group ID last used (both IDs refer to leaf resource group IDs). This resource tree will be intelligently optimized based on these IDs to more efficiently load and display content that users may be interested in.
[0155] After receiving the lazy-loaded resource tree data returned by the backend, the frontend will be responsible for rendering the tree. At the same time, the frontend will automatically expand the resource group with the highest weight and the resource group used last, so that users can directly access these important resources.
[0156] In this way, the system can provide users with a more personalized and efficient resource access experience, while reducing unnecessary resource loading and improving overall performance.
[0157] Based on the above embodiments, the present disclosure also provides a lazy loading tree optimization processing device for a browser, such as Figure 8 As shown, the lazy loading tree optimization processing device for the browser includes:
[0158] A loading module 201, configured to load resources under the leaf resource group in response to an instruction to expand the leaf resource group;
[0159] A determination module 202 is used to determine whether a maximum number of expanded and loaded leaf resource groups is preset;
[0160] The comparison module 203 is used to compare the number of currently expanded leaf resource groups with the maximum number of expanded leaf resource groups if a maximum number of expanded leaf resource groups is preset;
[0161] The first processing module 204 is used to retrieve the leaf resource group with the lowest weight from the browser cache Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight when the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups.
[0162] In a specific embodiment, it also includes:
[0163] The parsing module 205 is used to receive and parse the maximum expanded and loaded leaf resource group number setting message to obtain the maximum expanded and loaded leaf resource group number.
[0164] In a specific embodiment, it also includes:
[0165] The second processing module 206 is used to obtain the number of browser tabs through the Windows component if the maximum number of expanded and loaded leaf resource groups is not preset; dynamically calculate and set the default maximum number of expanded and loaded leaf resource groups according to the number of browser tabs, and if the calculated result is less than or equal to 0, set it to 1; compare the current number of expanded leaf resource groups with the default maximum number of expanded and loaded leaf resource groups; if the current number of expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, retrieve the leaf resource group with the lowest weight from the Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight.
[0166] In a specific embodiment, it also includes:
[0167] Calculation module 207 is used to dynamically calculate the default maximum number of expanded and loaded leaf resource groups, including: calculating the result of 5 minus the number of the browser tabs plus 1. If the calculated result is greater than 0, it is set as the default maximum number of expanded and loaded leaf resource groups; otherwise, the default maximum number of expanded and loaded leaf resource groups is set to 1.
[0168] In a specific embodiment, it also includes:
[0169] The third processing module 208 is used to respond to the resource playback operation instruction, and the front end obtains the leaf resource group ID of the operated resource from the resource tree. The resource playback operation instruction includes: double-clicking the resource to play the video, right-clicking the resource to play the video, and dragging the resource to play the video; retrieving the leaf resource group ID from the MORE_USE_RESGROUPID object array of the Local Storage, and if the leaf resource group ID exists, increasing its weight; if the leaf resource group ID does not exist, adding the leaf resource group ID and its weight to the MORE_USE_RESGROUPID object array; sorting the MORE_USE_RESGROUPID object array in descending order according to the weight, and updating the MORE_USE_RESGROUPID in the Local Storage; storing the leaf resource group ID as the last used leaf resource group ID in the LAST_USE_RESGROUPID of the LocalStorage.
[0170] In a specific embodiment, it also includes:
[0171] The fourth processing module 209 is used to respond to the browser page instruction of opening the resource tree, and the front end obtains the leaf resource group ID with the largest weight in the MORE_USE_RESGROUPID object array and the last used leaf resource group ID stored in the LAST_USE_RESGROUPID from the Local Storage; calls the back-end interface to initialize the resource tree, and passes the obtained leaf resource group ID with the largest weight and the last used leaf resource group ID as parameters to the back end; the back end builds a lazy loading resource tree according to the received leaf resource group ID, and the lazy loading resource tree preferentially includes the leaf resource group with the largest weight and the leaf resource group used last time; the front end receives the data of the lazy loading resource tree returned by the back end, and renders the lazy loading resource tree; after the rendering is completed, the front end automatically expands the leaf resource group with the largest weight and the leaf resource group used last time.
[0172] In a specific embodiment, it also includes:
[0173] The cleaning module 210 is used to regularly clean up the leaf resource group usage records in the Local Storage and delete the leaf resource group IDs and weight information thereof that have not been used for a preset time.
[0174] In a specific embodiment, it also includes:
[0175] The cache management module 211 is used to record and manage the weight information of the resource group in the Local storage.
[0176] The lazy loading tree optimization processing device for browsers provided by the disclosed embodiment realizes that when multiple data leaf resource groups are continuously expanded, the front end is smooth and has no lag; the leaf resource groups corresponding to commonly used resources are intelligently initialized and expanded; the front end cache automatically cleans up uncommon resources to maintain a reasonable range; the resource leaf group IDs that have been visited are recorded and the weights are increased to support intelligent recommendations; the front end can control the number of leaf resource groups N that are opened and loaded at the same time, which can be configured or dynamically adjusted according to the browser tab, and the historical groups are automatically cleaned up when the number exceeds the limit, ensuring the effective use of system resources and stable performance. The user interaction experience, response speed and resource management efficiency of the resource tree are improved.
[0177] For the device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0178] The present application also provides a computer device. Figure 3 , Figure 3 This is a basic structural block diagram of the computer device in this embodiment.
[0179] The computer device includes a memory 310 and a processor 320 that are connected to each other through a system bus. It should be noted that the figure only shows a computer device with components 310-320, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc.
[0180] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0181] The memory 310 includes at least one type of readable storage medium, and the readable storage medium includes a non-volatile memory or a volatile memory, for example, a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc., and the RAM may include a static RAM or a dynamic RAM. In some embodiments, the memory 310 may be an internal storage unit of a computer device, for example, a hard disk or a memory of the computer device. In other embodiments, the memory 310 may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, or a flash card (FlashCard) equipped on the computer device. Of course, the memory 310 may also include both the internal storage unit of the computer device and its external storage device. In this embodiment, the memory 310 is generally used to store the operating system and various application software installed on the computer device, such as the program code of the above method. In addition, the memory 310 may also be used to temporarily store various data that have been output or are to be output.
[0182] The processor 320 is generally used to perform the overall operation of the computer device. In this embodiment, the memory 310 is used to store program codes or instructions, the program code includes computer operation instructions, and the processor 320 is used to execute the program codes or instructions stored in the memory 310 or process data, such as running the program code of the above method.
[0183] In this article, the bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus system can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0184] Another embodiment of the present application also provides a computer-readable medium, which may be a computer-readable signal medium or a computer-readable medium. A processor in a computer reads a computer-readable program code stored in the computer-readable medium, so that the processor can execute the functional actions specified in each step or a combination of steps in the above method; and generate a device for implementing the functional actions specified in each block or a combination of blocks in the block diagram.
[0185] Computer-readable media include but are not limited to electronic, magnetic, optical, electromagnetic, infrared memory or semiconductor systems, devices or apparatuses, or any appropriate combination of the foregoing, the memory is used to store program codes or instructions, the program codes include computer operating instructions, and the processor is used to execute the program codes or instructions of the above methods stored in the memory.
[0186] For the definitions of memory and processor, please refer to the description of the aforementioned computer device embodiment and will not be repeated here.
[0187] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0188] Each functional unit or module in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0189] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor (processor) to perform all or part of the steps of each embodiment method of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program code.
[0190] Unless the context clearly indicates otherwise, the singular form of the words used herein and in the appended claims includes the plural and vice versa. Thus, when referring to the singular, the plural form of the corresponding term is generally included. Similarly, the words "comprise" and "include" are to be interpreted as inclusive rather than exclusive. Likewise, the terms "include" and "or" should be interpreted as inclusive unless such interpretation is expressly prohibited herein. Where the term "example" is used herein, particularly when it is located after a group of terms, the "example" is merely exemplary and illustrative and should not be considered exclusive or comprehensive.
[0191] Further aspects and scopes of adaptability become apparent from the description provided herein. It should be understood that various aspects of the present application can be implemented individually or in combination with one or more other aspects. It should also be understood that the description and specific embodiments herein are intended for purposes of illustration only and are not intended to limit the scope of the present application.
[0192] Several embodiments of the present disclosure are described in detail above, but it is obvious that those skilled in the art can make various modifications and variations to the embodiments of the present disclosure without departing from the spirit and scope of the present disclosure. The protection scope of the present disclosure is defined by the attached claims.
Claims
1. A lazy loading tree optimization processing method for a browser, characterized in that: include: In response to an instruction to expand a leaf resource group, loading resources under the leaf resource group; Determine whether there is a preset maximum number of leaf resource groups to be expanded and loaded; If a maximum number of expanded leaf resource groups to be loaded is preset, then the number of currently expanded leaf resource groups is compared with the maximum number of expanded leaf resource groups to be loaded; When the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups, the leaf resource group with the lowest weight is retrieved from the browser cache Local storage, the resources under it are cleaned up, and the contraction status of the leaf resource group with the lowest weight is updated.
2. The method according to claim 1, characterized in that Before the step of loading the resources under the leaf resource group, the method includes: Receive and parse the maximum expanded and loaded leaf resource group number setting message to obtain the maximum expanded and loaded leaf resource group number.
3. The method according to claim 1, characterized in that After the step of determining whether a maximum number of expanded and loaded leaf resource groups is preset, the method further includes: If the maximum number of leaf resource groups to be expanded and loaded is not preset, the number of browser tabs is obtained through the Windows component; According to the number of the browser tabs, dynamically calculate and set the default maximum number of expanded loaded leaf resource groups, and if the calculated result is less than or equal to 0, set it to 1; Compare the number of leaf resource groups currently expanded with the default maximum number of leaf resource groups expanded and loaded; If the number of currently expanded leaf resource groups exceeds the default maximum number of expanded and loaded leaf resource groups, the leaf resource group with the lowest weight is retrieved from the Local storage, the resources under it are cleaned up, and the contraction status of the leaf resource group with the lowest weight is updated.
4. The method according to claim 3, characterized in that The default maximum number of expanded loaded leaf resource groups is dynamically calculated through the following steps: Calculate the result of 5 minus the number of browser tabs plus 1. If the calculated result is greater than 0, set it as the default maximum number of expanded and loaded leaf resource groups; otherwise, set the default maximum number of expanded and loaded leaf resource groups to 1.
5. The method according to claim 1, characterized in that Also includes: In response to the resource playback operation instruction, the front end obtains the leaf resource group ID of the operated resource from the resource tree, and the resource playback operation instruction includes: double-clicking the resource to play the video, right-clicking the resource to play the video, and dragging the resource to play the video; Retrieve the leaf resource group ID from the MORE_USE_RESGROUPID object array of the Local Storage, and if the leaf resource group ID exists, increase its weight; If the leaf resource group ID does not exist, add the leaf resource group ID and its weight to the MORE_USE_RESGROUPID object array; Sorting the MORE_USE_RESGROUPID object array in descending order according to weight, and updating the MORE_USE_RESGROUPID in the Local Storage; The leaf resource group ID is stored as the last used leaf resource group ID in the LAST_USE_RESGROUPID of the Local Storage.
6. The method according to claim 1, characterized in that Also includes: In response to an instruction to open a browser page containing a resource tree, the front end obtains from the Local Storage the leaf resource group ID with the largest weight in the MORE_USE_RESGROUPID object array and the leaf resource group ID last used stored in the LAST_USE_RESGROUPID; Calling the backend interface to initialize the resource tree, and passing the obtained leaf resource group ID with the largest weight and the leaf resource group ID used last as parameters to the backend; The backend constructs a lazy loading resource tree based on the received leaf resource group ID. The lazy loading resource tree preferentially includes the leaf resource group with the largest weight and the leaf resource group used last. The front end receives the data of the lazy loading resource tree returned by the back end, and renders the lazy loading resource tree; After rendering is completed, the front end automatically expands the leaf resource group with the largest weight and the leaf resource group used last.
7. The method according to claim 1, characterized in that Also includes: The leaf resource group usage records in the Local Storage are cleaned up regularly, and the leaf resource group IDs and weight information thereof that have not been used for a preset time are deleted.
8. A lazy loading tree optimization processing device for a browser, characterized in that: include: A loading module, configured to load resources under the leaf resource group in response to an instruction to expand the leaf resource group; A judgment module, used to judge whether a maximum number of expanded and loaded leaf resource groups is preset; A comparison module, for comparing the number of currently expanded leaf resource groups with the maximum number of expanded leaf resource groups loaded if a maximum number of expanded leaf resource groups loaded is preset; The first processing module is used to retrieve the leaf resource group with the lowest weight from the browser cache Local storage, clean up the resources under it, and update the contraction status of the leaf resource group with the lowest weight when the number of currently expanded leaf resource groups exceeds the maximum number of expanded and loaded leaf resource groups.
9. A computer device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Resource lazy loading method and device
CN121092803A