CN113536168B - Component processing method and device - Google Patents

Component processing method and device Download PDF

Info

Publication number
CN113536168B
CN113536168B CN202110618041.7A CN202110618041A CN113536168B CN 113536168 B CN113536168 B CN 113536168B CN 202110618041 A CN202110618041 A CN 202110618041A CN 113536168 B CN113536168 B CN 113536168B
Authority
CN
China
Prior art keywords
page
component
rendered
displayed
determining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110618041.7A
Other languages
Chinese (zh)
Other versions
CN113536168A (en
Inventor
王尚志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202110618041.7A priority Critical patent/CN113536168B/en
Publication of CN113536168A publication Critical patent/CN113536168A/en
Application granted granted Critical
Publication of CN113536168B publication Critical patent/CN113536168B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/986Document structures and storage, e.g. HTML extensions
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides a component processing method and device, wherein the method comprises the following steps: acquiring page information of a page to be displayed, and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information; judging whether components corresponding to the component identifiers to be rendered exist in a preset position for each component identifier to be rendered; when determining that no component corresponding to the component identifier to be rendered exists in the preset position, acquiring component data corresponding to the component identifier to be rendered, and rendering according to the component data to obtain the component corresponding to the component identifier to be rendered, repeatedly loading and rendering of the existing component are not needed, repeated loading of the component is reduced, accordingly resource waste can be reduced, time required for page display can be shortened, access speed of pages is improved, and user experience is high.

Description

Component processing method and device
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a component processing method and device.
Background
A Web page component, also known as the World Wide Web (www) component, includes various commonly used interface components. In developing a cloud platform system page, components are often required to be utilized. Currently, when a user accesses a page of the cloud platform system, all components corresponding to the page need to be loaded, that is, component data corresponding to the page needs to be rendered, so that corresponding components are displayed on the page.
However, when the page is jumped, that is, when the current page is jumped to the target page, all the component data corresponding to the target page are rendered, and when the current page is jumped back from the target page, all the components corresponding to the current page need to be reloaded, that is, the component data corresponding to the current page need to be re-rendered, so that the components are repeatedly loaded, and resource waste is caused.
Disclosure of Invention
The embodiment of the application provides a component processing method and device, which are used for solving the technical problem of resource waste in the prior art.
In a first aspect, an embodiment of the present application provides a method for processing a component, including:
acquiring page information of a page to be displayed, and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information;
judging whether components corresponding to the component identifiers to be rendered exist in a preset position for each component identifier to be rendered;
when the fact that the component corresponding to the component identifier to be rendered does not exist in the preset position is determined, component data corresponding to the component identifier to be rendered are obtained, and rendering is conducted according to the component data, so that the component corresponding to the component identifier to be rendered is obtained.
In one possible design, the determining, according to the page information, the identifier of the component to be rendered corresponding to the page to be displayed includes:
and determining a controller corresponding to the page to be displayed according to the page information, and determining a component identifier to be rendered corresponding to the page to be displayed through the controller.
In one possible design, the method further comprises:
when a page access request is received, acquiring a target network address in the page access request, and acquiring page information of a current page;
determining whether the page changes according to the target network address and the page information of the current page;
and if the page changes, determining the page to be displayed according to the target network address.
In one possible design, the page information of the current page includes a hash value corresponding to a network address of the current page;
the determining whether the page changes according to the target network address and the page information of the current page comprises the following steps:
obtaining a hash value corresponding to the target network address;
judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page;
if the page is the same, determining that the page is not changed;
if not, determining the page change.
In one possible design, the method further comprises:
when a page access request is received, acquiring weight values corresponding to all nodes;
and determining a target node according to the weight value corresponding to each node, and sending the page access request to the target node.
In one possible design, the preset location includes a cache.
In a second aspect, an embodiment of the present application provides a component processing apparatus, including:
the information acquisition module is used for acquiring page information of a page to be displayed and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information;
the processing module is used for judging whether components corresponding to the component identifiers to be rendered exist in the preset positions for each component identifier to be rendered;
the processing module is further configured to obtain component data corresponding to the component identifier to be rendered when it is determined that no component corresponding to the component identifier to be rendered exists in the preset position, and render the component according to the component data, so as to obtain a component corresponding to the component identifier to be rendered.
In one possible design, the information acquisition module is further configured to:
and determining a controller corresponding to the page to be displayed according to the page information, and determining a component identifier to be rendered corresponding to the page to be displayed through the controller.
In one possible design, the processing module is further configured to:
when a page access request is received, acquiring a target network address in the page access request, and acquiring page information of a current page;
determining whether the page changes according to the target network address and the page information of the current page;
and if the page changes, determining the page to be displayed according to the target network address.
In one possible design, the page information of the current page includes a hash value corresponding to a network address of the current page;
the processing module is further configured to:
obtaining a hash value corresponding to the target network address;
judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page;
if the page is the same, determining that the page is not changed;
if not, determining the page change.
In one possible design, the processing module is further configured to:
when a page access request is received, acquiring weight values corresponding to all nodes;
and determining a target node according to the weight value corresponding to each node, and sending the page access request to the target node.
In one possible design, the preset location includes a cache.
In a third aspect, an embodiment of the present application provides an electronic device, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executes the computer-executable instructions stored by the memory, causing the at least one processor to perform the component handling method as described above in the first aspect and the various possible designs of the first aspect.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium, where computer executable instructions are stored, which when executed by a processor, implement the component processing method according to the first aspect and the various possible designs of the first aspect.
In a fifth aspect, embodiments of the present application provide a computer program product comprising a computer program which, when executed by a processor, implements the component handling method according to the first aspect and the various possible designs of the first aspect.
The application provides a component processing method and equipment, which are used for determining all components corresponding to a page to be displayed, namely component identifications to be rendered, when the page to be displayed is required to be displayed, and respectively judging whether components corresponding to the component identifications to be rendered exist in preset positions or not.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions of the prior art, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it will be obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained according to these drawings without inventive effort to a person skilled in the art.
Fig. 1 is a schematic structural diagram of a cloud platform system according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a method for processing a component according to an embodiment of the present application;
FIG. 3 is a second flow chart of a component processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a component handling apparatus according to an embodiment of the present application;
fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
In the prior art, a cloud platform system organizes a page by re-opening a new window, when a user accesses a page of the system, all components corresponding to the page need to be loaded, and when the page is jumped, original resources are destroyed, namely, the examples of the components corresponding to the page can be destroyed, so when the user jumps back to the accessed page, the corresponding components need to be re-rendered, the problem that the components need to be repeatedly loaded occurs, performance is lost, and resource waste is caused.
Therefore, aiming at the problems, the technical conception of the application is to provide a cloud platform system based on a Vue frame, which adopts a front-end and rear-end separation mode, introduces an intermediate layer concept by combining a node. Js technology, and improves the loading speed of a front page. When the front end renders a page, the components obtained by rendering, namely the component examples, are stored in the cache, so that when the page is redisplayed, the components corresponding to the page can be directly obtained from the cache and introduced into the page, corresponding component data are not required to be obtained again to load the components, the repeated loading of the components is avoided, unnecessary loss of performance is avoided, the waste of resources is reduced, the page rendering speed is improved, the time of user access is shortened, and the user experience is high.
The technical solutions of the present disclosure and how the technical solutions of the present disclosure solve the above technical problems are described in detail below with specific examples. The following specific examples may be combined with each other, and some examples may not be repeated for the same or similar concepts or processes. Examples of the present disclosure will be described below with reference to the accompanying drawings.
Fig. 1 is a schematic structural diagram of a cloud platform system according to an embodiment of the present application, as shown in fig. 1, a cloud platform system 100 includes a front-end device 101 and a back-end device 102, where after receiving an access request input by a user, the front-end device 101 sends the access request to the back-end device 102 to obtain corresponding component data, and renders the component according to the component data, so as to render the component onto a page.
The front-end device 101 may be a server, a computer, or the like. The front-end equipment comprises a view layer consisting of a page component module and a route management module.
The backend device 102 may be a server, a computer, or the like.
In addition, the cloud platform system 100 further includes an interface layer through which the front-end device 101 and the backend device 102 communicate.
Fig. 2 is a schematic flow chart of a component processing method according to an embodiment of the present application, where an execution body of the embodiment may be an electronic device, and specifically, may be a front-end device in fig. 1. As shown in fig. 2, the method includes:
s201, acquiring page information of a page to be displayed, and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information.
In this embodiment, when a certain page needs to be displayed, the page is taken as a page to be displayed. And acquiring page information of the page to be displayed, so that the identification of all the components to be rendered corresponding to the page to be displayed can be acquired by utilizing the page information, and the identification of the components to be rendered can be obtained.
The components to be rendered corresponding to the pages to be displayed are components to be displayed of the pages to be displayed, namely the components to be loaded of the pages to be displayed.
Optionally, the page information of the page to be displayed includes an identification of the page to be displayed, the identification including one or more of: the network address of the page to be displayed, the hash value corresponding to the network address of the page to be displayed and the number of the page to be displayed.
The network addresses include IP (Internet Protocol ) addresses, url (Uniform Resource Locator, uniform resource locator) addresses, among others.
Further, optionally, when determining the hash value corresponding to the network address of the page to be displayed, performing hash calculation on the network address of the page to be displayed based on a preset hash function to obtain the hash value corresponding to the network address of the page to be displayed.
Optionally, when determining the component identifier to be rendered corresponding to the page to be displayed by using the page information of the page to be displayed, that is, the identifier of the page to be displayed, the component identifier corresponding to the identifier of the page to be displayed is searched from a preset page component identifier mapping table, and is determined to be the component identifier to be rendered.
S202, judging whether components corresponding to the component identifications to be rendered exist in the preset positions for each component identification to be rendered.
In this embodiment, when each component identifier to be rendered in all the component identifiers to be rendered corresponding to the page to be displayed is obtained, it is determined that a component corresponding to the component identifier to be rendered, that is, a component instance, exists in the preset position.
When the components corresponding to the components to be rendered are determined to exist in the preset positions, the fact that the components to be rendered do not need to be reused to obtain corresponding component data is indicated, so that the components corresponding to the components to be rendered can be directly introduced into the page to be displayed when the components to be rendered are used for obtaining the set of prices through the re-rendering of the component data, namely, the components corresponding to the components to be rendered are directly deployed on the page to be displayed, re-rendering of the components is not needed, repeated rendering of the components is avoided, repeated use of the components is achieved, and accordingly waste of resources is avoided.
Optionally, the preset location includes a cache.
S203, when the fact that the component corresponding to the component identifier to be rendered does not exist in the preset position is determined, component data corresponding to the component identifier to be rendered are obtained, and rendering is conducted according to the component data, so that the component corresponding to the component identifier to be rendered is obtained.
In this embodiment, for each component identifier to be rendered, when it is determined that a component corresponding to the component identifier to be rendered does not exist at a preset position, it indicates that a component corresponding to the component identifier to be rendered does not exist, and the component needs to be rendered and loaded, and then component data corresponding to the component identifier to be rendered is obtained, so that the component data is used for rendering on a page to be displayed, and a corresponding component, namely a component instance, is obtained, and loading of the component is achieved.
The component data comprises content such as classes, functions, images and videos.
Optionally, when acquiring the component data corresponding to the component identifier to be rendered, the component data may be acquired from a page file corresponding to the page to be displayed, or may be acquired from other storage locations, or may further send a corresponding request to the background device, so that the background device sends the relevant data corresponding to the page to be displayed to the electronic device, and thus the electronic device acquires the corresponding component data from the relevant data.
In this embodiment, when page display, that is, page loading is performed, it is determined whether a component to be loaded of a page exists in a preset position, that is, whether a component corresponding to the page exists is determined, if so, the corresponding component can be directly utilized without re-rendering, and if not, component data corresponding to the component is acquired, so that the corresponding component is rendered by utilizing the component data, thereby avoiding repeated rendering of the component.
From the above description, when a page to be displayed needs to be displayed, determining all components corresponding to the page to be displayed, namely, the component identifier to be rendered, and judging whether components corresponding to the component identifier to be rendered exist in preset positions respectively, when the components corresponding to the component identifier to be rendered do not exist in the preset positions, indicating that the components need to be loaded, acquiring component data corresponding to the components for loading and rendering by utilizing the component data corresponding to the components, when the components corresponding to the component identifier to be rendered exist in the preset positions, indicating that the components do not need to be repeatedly loaded, namely, the components do not need to be re-rendered, and the components can be directly utilized, namely, the components are only required to be rendered in the preset positions in the process of displaying the page to be displayed.
Fig. 3 is a second flow chart of a component processing method according to an embodiment of the present application, where when a page to be displayed is displayed based on the embodiment of fig. 2, whether page rendering is required is determined according to whether the page changes, and this process will be described with reference to a specific embodiment. As shown in fig. 3, the method includes:
s301, when a page access request is received, acquiring a target network address in the page access request, and acquiring page information of a current page.
In this embodiment, when a page access request input by a user is received, a target network address in the page access request is obtained, where the target network address is a network address of a page to be accessed, and page information of a current page, that is, a page currently displayed by the electronic device, is obtained, so as to determine whether a page needs to be skipped or not by using the page information of the current page and the target network address, that is, whether the page needs to be changed or not is determined.
Optionally, the page information of the current page includes a network address of the current page and/or a hash value corresponding to the network address of the current page.
Optionally, when the user performs operations such as clicking a hyperlink or switching Tab pages, a corresponding page access request is generated. For example, when the user clicks on a hyperlink in the current page, a corresponding page access request is left, and the network address corresponding to the hyperlink is the target network address.
S302, determining whether the page changes according to the target network address and the page information of the current page.
In this embodiment, after obtaining the target network address of the page to be accessed and the page information of the current page, it is determined whether the page to be accessed is the current page by using the target network address and the page information of the current page, that is, whether the page needs to be changed is determined, so as to determine whether to skip to a new page, thereby determining whether to load the page.
In the present embodiment, when determining whether a page has changed using the target network address and page information of the current page, the determination may be made in the following manner.
One way is to judge whether the network address of the target network is the same as the network address of the current page, if so, the page corresponding to the target network address is the current page, that is, the page does not need to be jumped, and then the page is determined to be unchanged, that is, the page does not change. If the page is different, indicating that the page corresponding to the target network address is not the current page, and determining that the page is changed if the page needs to be jumped.
Another way is to obtain a hash value corresponding to the target network address. And judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page. If so, determining that the page is unchanged. If not, determining the page change.
Specifically, hash calculation is performed on the target network address through a preset hash function, so as to obtain a hash value corresponding to the target network address. Judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page, if so, indicating that the page corresponding to the target network address is the current page, namely, no page jump is needed, and determining that the page does not need to be changed, namely, the page does not change. If the page is different, indicating that the page corresponding to the target network address is not the current page, and determining that the page is changed if the page needs to be jumped.
The hash function used for calculating the hash value corresponding to the target network address is the same as the hash function used for calculating the hash value corresponding to the network address of the current page.
S303, if the page changes, determining the page to be displayed according to the target network address.
In this embodiment, when it is determined that a change needs to occur, it indicates that a page needs to be skipped, that is, a page corresponding to a target network address needs to be skipped, and then the page corresponding to the target network address is used as a page to be displayed, so as to load the page to be displayed.
S304, acquiring page information of the page to be displayed, and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information.
In this embodiment, when performing page display, that is, page loading, the controller may be used to perform loading, that is, obtain a controller corresponding to page information, that is, a network address of a page to be displayed, and determine the controller as a controller corresponding to the page to be displayed, so as to perform page rendering operation by using the controller, for example, determine, according to the page information, an identifier of a component to be rendered corresponding to the page to be displayed, so as to determine a corresponding component by using the identifier of the component to be rendered.
The routing management module establishes a corresponding relation between a network address (for example, a URL address) and a controller through a URL create class, mainly uses two methods of regToPath and historyManager to perform routing management, keeps the network address and a system UI synchronous, maintains browser history information according to a page address browsed by a user through using a historyManager function and updates a history object, and matches the controller corresponding to the URL address through the regToPath function so as to update the UI through the controller.
S305, judging whether components corresponding to the component identifications to be rendered exist in the preset positions for each component identification to be rendered.
S306, when the fact that the component corresponding to the component identifier to be rendered does not exist in the preset position is determined, component data corresponding to the component identifier to be rendered are obtained, and rendering is conducted according to the component data, so that the component corresponding to the component identifier to be rendered is obtained.
In this embodiment, the component data corresponding to the component identifier to be rendered is utilized to render, so as to obtain a component corresponding to the component identifier to be rendered, namely a component instance, and the component corresponding to the component identifier to be rendered is stored to a preset position, so that the component can be directly utilized from the preset position instead of directly destroying the component instance, thereby avoiding repeated rendering of the component.
In addition, in order to improve the access efficiency and the success rate, a target node can be determined based on a load balancing rule so as to carry out page loading by using the target node, namely, when a page access request is received, the weight value corresponding to each node is obtained; and determining a target node according to the weight value corresponding to each node, and sending the page access request to the target node.
In this embodiment, when a page access request is received, that is, when it is determined that a page to be displayed corresponding to a target network address in the page access request needs to be displayed, a server node with the highest weight value, that is, a node is selected, is determined as a target node, and the page access request is sent to the target node, so that the target node sends a page file and/or component data corresponding to the page to be displayed to the electronic device, thereby enabling the electronic device to acquire the data required by the electronic device and render the data.
In addition, when the fact that the component corresponding to the component identifier to be rendered does not exist in the preset position is determined, the component identifier to be rendered is determined to be the target component identifier, all the target component identifiers are obtained, a data request comprising the target component identifier is generated, the data request is sent to the target node, the target node is enabled to send the component data corresponding to the target component identifier to the electronic device, and therefore the electronic device can only obtain needed data.
The node is a server, specifically, may be an nminix server, which is a background device.
In addition, when a request (e.g., a page access request, a data request) needs to be sent to one node, the request may be sent to the target nmginx server, so that the target nmginx server obtains the weight value of each node, and determines the target node according to the weight value of each node.
The weight value corresponding to the node may be preset and unchanged, or may be adjusted in real time according to the load condition of the node, for example, after the request is allocated to one node, the preset value (for example, 1) is subtracted from the weight value corresponding to the node.
In this embodiment, the weight of the node determines the probability that the node is allocated to the request, the weight configuration can be configured according to the performance of the node as required, the weight of the high-performance server node is large, and the weight of the low-performance server node is small, so that the server resource can be more reasonably utilized, the user request can be responded more quickly, and the performance of the low-performance server is prevented from being reduced due to excessive allocation requests.
In this embodiment, a front-end and back-end separation architecture is adopted, the front end is responsible for page rendering, and performs data processing and transmission through a unified data format negotiated with the back end, for a single machine processing performance bottleneck which may occur in the front end, an instance node is added through lateral expansion, a load balancing nminux server is exposed uniformly to the outside, the availability of the system can be guaranteed to the greatest extent under the condition that the system faces high concurrency is guaranteed through a load balancing policy, and finally, a quick and stable use experience can be provided for a user.
In this embodiment, the cloud platform system includes a view layer composed of a page component module and a route management module, an interface layer for providing unified interface service to the outside, and a service layer for responding to a client request and delivering the result to the interface layer for further processing, where the view layer adopts a modular design, monitors url change information of a current page in real time through the route management module, selects a corresponding component to render to the page, the interface layer communicates with node.js through Ajax, transmits a user request to the service layer, and the service layer acquires corresponding server data in cooperation with an nginnx load balancing policy.
In this embodiment, the view layer divides the same type of requirements or functional modules into the same components according to the service logic, so that the service logic is guaranteed to be highly uniform, convenience is provided for subsequent maintenance, and when the requirements change, the solution and the reconstruction are easier to achieve in a targeted manner.
In this embodiment, the interface layer receives the front-end request, obtains the finally matched component through regToPath function according to the target network address in the page access request, requests the needed data from the background server through the pre-obtaining method, writes the data back to the HTML (Hyper Text Markup Language ) document, and finally returns the HTML document with the complete data to the browser for rendering by the browser.
S307, if the page is unchanged, page information of the page to be displayed is not required to be acquired.
In this embodiment, when it is determined that the page is unchanged, that is, when it is determined that the page does not need to be changed, it indicates that page jump is not required, that is, when the page to be accessed by the user is the current page, it is not required to acquire page information of the page to be displayed, that is, page loading is not required.
In this embodiment, whether the hash value of the network address of the page changes is detected, and when the hash value of the network address of the captured page changes, a corresponding component is selected to be rendered to the page, so that unnecessary page rendering is avoided, and resource waste is reduced.
In this embodiment, the routing management module monitors whether the network address of the page changes, and selects a corresponding component to render onto the page when the network address of the page changes.
In this embodiment, the UtilsAjax method embeds url and options parameters to configure the corresponding interface address of the background device and the configuration information of the current request, and returns a Promigs object, thereby shielding the inconsistency between synchronous and asynchronous codes and further reducing the pressure of subsequent development and maintenance. And sending a data request to a service layer, namely a background device by utilizing UtilsAjax, and injecting an API and intercepting url-schema by calling a native APP. The interception url-schema mainly utilizes a Web terminal to send url-schema requests through iframe.src, intercepts corresponding requests according to Native and carries out interception operation according to parameter information carried by the url-schema.
In this embodiment, when the background device cannot work normally, the target nmginx server resets the identification bits of all the machines, i.e. the nodes, so as to avoid the problem that the front end is always in an unresponsive state because the background device is in a timeout condition.
In this embodiment, aiming at the problem that a single nmginx server may be down or stop service in the actual running process, the application configures a high-availability cluster by combining keep and nmginx, so as to ensure that the load balancing server node can cope with the abnormal situation and continuously provide normal service.
Fig. 4 is a schematic structural diagram of a component handling apparatus according to an embodiment of the present application, and as shown in fig. 4, the component handling apparatus 400 includes: an information acquisition module 401 and a processing module 402.
The information obtaining module 401 is configured to obtain page information of a page to be displayed, and determine, according to the page information, an identifier of a component to be rendered corresponding to the page to be displayed.
The processing module 402 is configured to determine, for each component identifier to be rendered, whether a component corresponding to the component identifier to be rendered exists in the preset position.
The processing module 402 is further configured to, when it is determined that the component corresponding to the component identifier to be rendered does not exist in the preset position, obtain component data corresponding to the component identifier to be rendered, and perform rendering according to the component data, so as to obtain a component corresponding to the component identifier to be rendered.
In any embodiment, optionally, the preset location includes a cache.
In another embodiment of the present application, based on the embodiment shown in fig. 4, the processing module 402 is further configured to:
when a page access request is received, a target network address in the page access request is acquired, and page information of a current page is acquired.
And determining whether the page changes according to the target network address and the page information of the current page.
If the page changes, determining the page to be displayed according to the target network address.
In this embodiment, optionally, the page information of the current page includes a hash value corresponding to the network address of the current page.
The processing module 402 is further configured to:
and obtaining a hash value corresponding to the target network address.
And judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page.
If so, determining that the page is unchanged.
If not, determining the page change.
In any embodiment, optionally, the processing module 402 is further configured to:
and when a page access request is received, acquiring weight values corresponding to all nodes.
And determining a target node according to the weight value corresponding to each node, and sending the page access request to the target node.
In any embodiment, optionally, the information obtaining module 401 is further configured to:
and determining a controller corresponding to the page to be displayed according to the page information, and determining the identification of the component to be rendered corresponding to the page to be displayed through the controller.
Fig. 5 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application. As shown in fig. 5, the electronic apparatus 500 of the present embodiment includes: a processor 501 and a memory 502;
wherein, the memory 502 is used for storing computer execution instructions;
the processor 501 is configured to execute computer-executable instructions stored in the memory to implement the steps performed by the receiving device in the above-described embodiment. Reference may be made in particular to the relevant description of the embodiments of the method described above.
Alternatively, the memory 502 may be separate or integrated with the processor 501.
When the memory 502 is provided separately, the electronic device further comprises a bus 503 for connecting said memory 502 and the processor 501.
The embodiment of the application also provides a computer readable storage medium, wherein computer execution instructions are stored in the computer readable storage medium, and when a processor executes the computer execution instructions, the component processing method is realized.
The embodiment of the application also provides a computer program product, comprising a computer program which, when being executed by a processor, realizes the component processing method as described above.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the division of the modules is merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple modules may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or modules, which may be in electrical, mechanical, or other forms.
The modules described as separate components may or may not be physically separate, and components shown as modules may or may not be physical units, may be located in one place, or may be distributed over multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present application may be integrated in one processing unit, or each module may exist alone physically, or two or more modules may be integrated in one unit. The units formed by the modules can be realized in a form of hardware or a form of hardware and software functional units.
The integrated modules, which are implemented in the form of software functional modules, may be stored in a computer readable storage medium. The software functional module is stored in a storage medium, and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (english: processor) to perform some of the steps of the methods according to the embodiments of the application.
It should be understood that the above processor may be a central processing unit (english: central Processing Unit, abbreviated as CPU), or may be other general purpose processors, digital signal processors (english: digital Signal Processor, abbreviated as DSP), application specific integrated circuits (english: application Specific Integrated Circuit, abbreviated as ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
The memory may comprise a high-speed RAM memory, and may further comprise a non-volatile memory NVM, such as at least one magnetic disk memory, and may also be a U-disk, a removable hard disk, a read-only memory, a magnetic disk or optical disk, etc.
The bus may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, among others. The buses may be divided into address buses, data buses, control buses, etc. For ease of illustration, the buses in the drawings of the present application are not limited to only one bus or to one type of bus.
The storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disk. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
An exemplary storage medium is coupled to the processor such the processor can read information from, and write information to, the storage medium. In the alternative, the storage medium may be integral to the processor. The processor and the storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC for short). It is also possible that the processor and the storage medium reside as discrete components in an electronic device or a master device.
Those of ordinary skill in the art will appreciate that: all or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The foregoing program may be stored in a computer readable storage medium. The program, when executed, performs steps including the method embodiments described above; and the aforementioned storage medium includes: various media that can store program code, such as ROM, RAM, magnetic or optical disks.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present application, and not for limiting the same; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some or all of the technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit of the application.

Claims (9)

1. A method of processing a component, comprising:
acquiring page information of a page to be displayed, and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information;
judging whether components corresponding to the component identifiers to be rendered exist in a preset position for each component identifier to be rendered;
when the fact that the component corresponding to the component identifier to be rendered does not exist in the preset position is determined, component data corresponding to the component identifier to be rendered are obtained, rendering is conducted according to the component data, the component corresponding to the component identifier to be rendered is obtained, and the component corresponding to the component identifier to be rendered is stored in the preset position.
2. The method of claim 1, wherein the determining, according to the page information, a component identifier to be rendered corresponding to the page to be displayed includes:
and determining a controller corresponding to the page to be displayed according to the page information, and determining a component identifier to be rendered corresponding to the page to be displayed through the controller.
3. The method according to claim 1, wherein the method further comprises:
when a page access request is received, acquiring a target network address in the page access request, and acquiring page information of a current page;
determining whether the page changes according to the target network address and the page information of the current page;
and if the page changes, determining the page to be displayed according to the target network address.
4. A method according to claim 3, wherein the page information of the current page includes a hash value corresponding to the network address of the current page;
the determining whether the page changes according to the target network address and the page information of the current page comprises the following steps:
obtaining a hash value corresponding to the target network address;
judging whether the hash value corresponding to the target network address is the same as the hash value corresponding to the network address of the current page;
if the page is the same, determining that the page is not changed;
if not, determining the page change.
5. A method according to claim 3, characterized in that the method further comprises:
when a page access request is received, acquiring weight values corresponding to all nodes;
and determining a target node according to the weight value corresponding to each node, and sending the page access request to the target node.
6. The method of any one of claims 1 to 5, wherein the preset location comprises a cache.
7. A component handling apparatus, comprising:
the information acquisition module is used for acquiring page information of a page to be displayed and determining a component identifier to be rendered corresponding to the page to be displayed according to the page information;
the processing module is used for judging whether components corresponding to the component identifiers to be rendered exist in the preset positions for each component identifier to be rendered;
the processing module is further configured to obtain component data corresponding to the component identifier to be rendered when it is determined that no component corresponding to the component identifier to be rendered exists in the preset position, perform rendering according to the component data, obtain a component corresponding to the component identifier to be rendered, and store the component corresponding to the component identifier to be rendered to the preset position.
8. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing computer-executable instructions stored in the memory causes the at least one processor to perform the component processing method of any one of claims 1 to 6.
9. A computer-readable storage medium having stored therein computer-executable instructions which, when executed by a processor, implement the component processing method of any one of claims 1 to 6.
CN202110618041.7A 2021-06-03 2021-06-03 Component processing method and device Active CN113536168B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110618041.7A CN113536168B (en) 2021-06-03 2021-06-03 Component processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110618041.7A CN113536168B (en) 2021-06-03 2021-06-03 Component processing method and device

Publications (2)

Publication Number Publication Date
CN113536168A CN113536168A (en) 2021-10-22
CN113536168B true CN113536168B (en) 2023-11-14

Family

ID=78095075

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110618041.7A Active CN113536168B (en) 2021-06-03 2021-06-03 Component processing method and device

Country Status (1)

Country Link
CN (1) CN113536168B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117390326A (en) * 2023-12-12 2024-01-12 深圳市深圳通有限公司 Page management method, device, equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461632A (en) * 2014-12-09 2015-03-25 东软集团股份有限公司 Web App loading method and device
CN109241469A (en) * 2018-09-13 2019-01-18 安徽智恒信科技有限公司 A method of multi-page switching is realized based on vue
CN110020388A (en) * 2018-12-25 2019-07-16 阿里巴巴集团控股有限公司 A kind of page display method and system
CN111443912A (en) * 2020-03-25 2020-07-24 平安医疗健康管理股份有限公司 Page rendering method and device based on components, computer equipment and storage medium
CN111581563A (en) * 2020-04-30 2020-08-25 北京字节跳动网络技术有限公司 Page response method and device, storage medium and electronic equipment
CN111708600A (en) * 2020-08-20 2020-09-25 腾讯科技(深圳)有限公司 Page display method, device, equipment and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10409440B2 (en) * 2016-10-14 2019-09-10 Sap Se Flexible-page layout

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461632A (en) * 2014-12-09 2015-03-25 东软集团股份有限公司 Web App loading method and device
CN109241469A (en) * 2018-09-13 2019-01-18 安徽智恒信科技有限公司 A method of multi-page switching is realized based on vue
CN110020388A (en) * 2018-12-25 2019-07-16 阿里巴巴集团控股有限公司 A kind of page display method and system
CN111443912A (en) * 2020-03-25 2020-07-24 平安医疗健康管理股份有限公司 Page rendering method and device based on components, computer equipment and storage medium
CN111581563A (en) * 2020-04-30 2020-08-25 北京字节跳动网络技术有限公司 Page response method and device, storage medium and electronic equipment
CN111708600A (en) * 2020-08-20 2020-09-25 腾讯科技(深圳)有限公司 Page display method, device, equipment and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
An analysis of visual and presentation factors influencing the design of e-commerce web sites;Banatus soiraya 等;《2008 IEEE/WIC/ACM international conference on web intelligence and intelligent agent technology》;第1-2页 *
云平台下Web前端的若干优化技术的研究与实现;潘文文;《中国优秀硕士学位论文全文数据库信息科技辑》;第30、36-48页 *
知乎.vue组件缓存之keep-alive正确使用姿势.《https://www.zhihu.com/tardis/bd/art/352059246?source_id=1001》,2021,第1-6页. *

Also Published As

Publication number Publication date
CN113536168A (en) 2021-10-22

Similar Documents

Publication Publication Date Title
US11647096B2 (en) Method and apparatus for automatically optimizing the loading of images in a cloud-based proxy service
US10783211B2 (en) Page processing method and device thereof
US9565265B2 (en) Method and apparatus for automatically optimizing the loading of images in a cloud-based proxy service
US20140006487A1 (en) Methods for making ajax web applications bookmarkable and crawable and devices thereof
CN113468456B (en) Webpage rendering method and device, electronic equipment and computer-readable storage medium
EP3528474B1 (en) Webpage advertisement anti-shielding methods and content distribution network
CN111198998A (en) Network page loading method, device and system based on Ajax request
CN113238754A (en) Server rendering method and device, server and storage medium
EP3896940A1 (en) Resource description file processing, and page resource obtaining method and device
CN111787036A (en) Solution method, device, storage medium and equipment for front-end private cloud deployment
KR20210040864A (en) File directory traversal method, apparatus, device, and medium
CN111371585A (en) Configuration method and device for CDN node
CN113536168B (en) Component processing method and device
CN112926002A (en) Service request processing method and device
CN111783005A (en) Method, apparatus and system for displaying web page, computer system and medium
US10990750B2 (en) Dynamically bundling web page resources
CN113961298A (en) Page switching method, device, equipment and medium
CN112783548B (en) Access method and device of network system
CN111090515A (en) Access control method, device, terminal equipment and storage medium
US20140237133A1 (en) Page download control method, system and program for ie core browser
CN112149016A (en) Page processing method, device, equipment and storage medium
CN112565472A (en) Static resource processing method and device
CN113849255B (en) Data processing method, device and storage medium
US20240089339A1 (en) Caching across multiple cloud environments
CN112948011B (en) Method and device for loading secondary page

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant