Front-end component development method, device, electronic device and readable storage medium
By building a communication link between the parent web page and the child web page in the front-end interface, and using message listening technology, the compatibility problem between multiple web pages is solved, and the web page processing efficiency and user experience are improved.
Patent Information
- Application Number
- CN202111362655.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-17
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-11-17
AI Technical Summary
Due to the inconsistency of the technology stack in the traditional front-end interface, it is difficult to be compatible between multiple web pages and cannot synchronize the instructions and codes input by the user, resulting in low web page processing efficiency.
By constructing a parent web page and multiple child web pages, establishing communication links, and using message monitoring to synchronously process user input information on each child web page, the parent web page forms a componentized synchronization service architecture.
It realizes synchronization processing between multiple web pages, improves the efficiency of web page processing, reduces the delay time of user search, and optimizes the user experience.
Smart Images

Figure CN114064033B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of system performance optimization, and in particular to a front-end component development method, device, electronic device and readable storage medium. Background Art
[0002] Front-end development is the process of creating front-end interfaces such as web pages or apps to present to users. It uses HTML, CSS, JavaScript, and various derived technologies, frameworks, and solutions to realize user interface interaction of Internet products.
[0003] The multiple web pages of the traditional front-end interface are often incompatible due to the inconsistent architecture versions of the technology stack. In addition, when the user enters the command code, the messages of multiple web pages cannot be shared, resulting in the inability to synchronously process the user's input commands and codes on multiple web pages at the same time, which reduces the efficiency of web page processing problems. Summary of the invention
[0004] The present invention provides a front-end component development method, device, electronic device and computer-readable storage medium, which aims to improve the efficiency of solving problems on web pages.
[0005] To achieve the above object, the present invention provides a front-end component development method, comprising:
[0006] Build a parent web page and multiple child web pages;
[0007] Establishing a communication link between each of the child web pages and the parent web page;
[0008] According to the communication link, in the form of message monitoring, the search information input by the user in any sub-web page is synchronously processed in each of the sub-web pages, so that the parent web page forms a componentized synchronization service architecture.
[0009] Optionally, constructing a parent web page and a plurality of child web pages includes:
[0010] Constructing the DOM tree and shadow DOM tree of the parent web page frame and the DOM tree and shadow DOM tree of each child web page frame;
[0011] Setting the page rules of the DOM tree of the parent web page frame to obtain the parent page rules, and setting the page rules of the DOM tree of the child web page frame to obtain the child page rules;
[0012] Constructing a parent page rule document using the parent page rule, and constructing a child page rule document using the child page rule;
[0013] Convert the byte content in the parent page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the parent page rule, and convert the multiple attribute-attribute value pairs in the parent web page frame into tree nodes and link them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame;
[0014] Convert the byte content in the sub-page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the sub-page rule, and convert the multiple attribute-attribute value pairs in the sub-page frame into tree nodes and link them to the DOM tree of the sub-page frame and the shadow DOM tree of the sub-page frame to obtain a complete shadow DOM tree of the sub-page frame;
[0015] According to the complete shadow DOM tree of the parent web page frame, the page of the parent web page frame is drawn using a preset page drawing tool to obtain a parent web page, and according to the complete shadow DOM tree of the child web page frame, the page of the child web page frame is drawn using the page drawing tool to obtain a child web page.
[0016] Optionally, converting the plurality of attribute-attribute value pairs in the parent web page frame into tree nodes and linking them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame includes:
[0017] Convert the attribute-attribute value pair of the parent web page frame into a CSS tree node in the shadow DOM tree of the parent web page frame;
[0018] Configure the CSS style of each tree node in the shadow DOM tree of the parent web page frame;
[0019] According to the correspondence between each tree node of the shadow DOM tree of the parent web page frame and the CSS tree node, the corresponding CSS tree node is linked to the tree node of the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame.
[0020] Optionally, the building of a communication link between each of the child web pages and the parent web page includes:
[0021] Obtaining a webpage link of the sub-webpage;
[0022] Dividing the parent web page into blocks according to a preset height to obtain web page blocks;
[0023] According to the web page link, the sub-web page is scaled down and filled into the web page block, so as to realize data communication between the sub-web page and the parent web page and obtain a communication link.
[0024] Optionally, the building of a communication link between each of the child web pages and the parent web page includes:
[0025] In response to the transmission request of the child web page, creating a demand request in the child web page, and sending the demand request to the parent web page;
[0026] The parent web page responds to the demand request and transmits the demand data to the child web page to complete the construction of the communication link.
[0027] Optionally, the method adopts the form of message monitoring to synchronously process the search information input by the user in any sub-web page on each sub-web page, including:
[0028] When any of the sub-webpages receives the search information input by the user, the sub-webpage triggers a predefined event instruction to transmit the search information to the parent webpage;
[0029] The parent web page receives the search information and issues event processing instructions to other child web pages according to the search information.
[0030] Optionally, after the parent webpage is made to form a componentized synchronization service architecture, the method further includes:
[0031] Monitor the actual height of each sub-webpage in real time;
[0032] When the sub-webpage has a content shielding problem, the actual height of the sub-webpage is adjusted using the communication link.
[0033] In order to solve the above problems, the present invention also provides a front-end component development device, the device comprising:
[0034] A page building module is used to build a parent web page and multiple child web pages;
[0035] A communication link building module, used to establish a communication link between each of the child web pages and the parent web page;
[0036] The synchronous service architecture building module is used to synchronously process the search information input by the user in any sub-web page in the form of message monitoring according to the communication link, so that the parent web page forms a componentized synchronous service architecture.
[0037] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0038] a memory storing at least one computer program; and
[0039] The processor executes the computer program stored in the memory to implement the front-end component development method described above.
[0040] In order to solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one computer program is stored. The at least one computer program is executed by a processor in an electronic device to implement the above-mentioned front-end component development method.
[0041] The front-end componentized development method, device, electronic device and computer-readable storage medium proposed in the present invention construct a parent web page and multiple child web pages, establish a communication link between each child web page and the parent web page, and based on the communication link, use the form of message monitoring to synchronously process the search information entered by the user in any child web page on each child web page, so that the parent web page forms a componentized synchronization service architecture, which can synchronously process the instructions and codes entered by the user, thereby improving the efficiency of web page processing problems. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] Figure 1 A schematic diagram of a process flow of a front-end component development method provided by an embodiment of the present invention;
[0043] Figure 2 A schematic diagram of a module of a front-end component development device provided by an embodiment of the present invention;
[0044] Figure 3 A schematic diagram of the internal structure of an electronic device for implementing a front-end component development method provided by an embodiment of the present invention;
[0045] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0046] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0047] The embodiment of the present invention provides a front-end component development method. The execution subject of the front-end component development method includes but is not limited to at least one of the electronic devices such as the server and the terminal that can be configured to execute the method provided by the embodiment of the present application. In other words, the front-end component development method can be executed by software or hardware installed on the terminal device or the server device, and the software can be a blockchain platform. The server may include an independent server, or may include a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms.
[0048] Reference Figure 1 FIG. 1 is a flow chart of a front-end component development method provided by an embodiment of the present invention. In the embodiment of the present invention, the front-end component development method includes:
[0049] S1. Build a parent web page and multiple child web pages.
[0050] The embodiment of the present invention first constructs a parent web page frame and multiple child web page frames, and constructs pages for the parent web page frame and the child web page frames to obtain the parent web page and multiple child web page pages. The parent web page frame is an overall functional web page frame that can link other child web pages, and the child web page frame is a sub-functional web page frame that can exist in the parent web page frame and has certain functions. For example, the Baidu browser web page and the 361 browser web page are linked in a page frame, the page frame is the parent page frame, and the Baidu browser web page and the 361 browser web page are the child web page frames. In the embodiment of the present invention, each of the child web page frames can independently realize a given function.
[0051] In detail, the construction of a parent web page and a plurality of child web pages includes:
[0052] Constructing a DOM tree and a shadow DOM tree of the parent web page frame, and constructing a DOM tree and a shadow DOM tree of each child web page frame;
[0053] Setting the page rules of the DOM tree of the parent web page frame to obtain the parent page rules, and setting the page rules of the DOM tree of the child web page frame to obtain the child page rules;
[0054] Constructing a parent page rule document using the parent page rule, and constructing a child page rule document using the child page rule;
[0055] Convert the byte content in the parent page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the parent page rule, and convert the multiple attribute-attribute value pairs in the parent web page frame into tree nodes and link them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame;
[0056] Convert the byte content in the sub-page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the sub-page rule, and convert the multiple attribute-attribute value pairs in the sub-page frame into tree nodes and link them to the DOM tree of the sub-page frame and the shadow DOM tree of the sub-page frame to obtain a complete shadow DOM tree of the sub-page frame;
[0057] According to the complete shadow DOM tree of the parent web page frame, the page of the parent web page frame is drawn using a preset page drawing tool to obtain a parent web page, and according to the complete shadow DOM tree of the child web page frame, the page of the child web page frame is drawn using the page drawing tool to obtain a child web page.
[0058] In the embodiment of the present invention, the DOM tree can be a plurality of code blocks independently written by the user, and the main code blocks and the nested code blocks in the code blocks form a multi-layer tree relationship structure. For example, the main code block of "My Computer" is nested with nested code blocks such as "C Drive" and "D Drive". Furthermore, each drive has many folders, and the folders are nested in folders. The process of opening files layer by layer is equivalent to the process of traversing from the root node to the leaf node. The main body and the nested body constitute a structural relationship tree, which is the DOM tree. The shadow DOM tree is a multi-layer tree structure hidden behind the DOM tree and can complete the functions contained in the DOM tree.
[0059] Furthermore, converting the plurality of attribute-attribute value pairs in the parent web page frame into tree nodes and linking them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame includes:
[0060] Convert the attribute-attribute value pair of the parent web page frame into a CSS tree node in the shadow DOM tree of the parent web page frame;
[0061] Configure the CSS style of each tree node in the shadow DOM tree of the parent web page frame;
[0062] According to the correspondence between each tree node of the shadow DOM tree of the parent web page frame and the CSS tree node, the corresponding CSS tree node is linked to the tree node of the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame.
[0063] In the embodiment of the present invention, the CSS may be a computer language used to express the style of files such as HTML or XML.
[0064] Furthermore, the step of converting the plurality of attribute-attribute value pairs in the child web page into tree nodes and linking them to the DOM tree of the child web page frame and the shadow DOM tree of the child web page frame is the same as the step of converting the plurality of attribute-attribute value pairs in the parent web page frame into tree nodes and linking them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame, so it will not be repeated here.
[0065] S2. Establish a communication link between each of the child web pages and the parent web page.
[0066] In the embodiment of the present invention, the communication link may be a channel for the child web page to share data with the parent web page. Furthermore, both parties building the communication link need to have a common language.
[0067] In an optional embodiment of the present invention, a web page segmentation technology may be used to construct a communication link between each of the child web pages and the parent web page, wherein the web page segmentation technology may be implemented using div plus css.
[0068] In detail, the construction of a communication link between each of the child web pages and the parent web page includes:
[0069] Obtaining a webpage link of the sub-webpage;
[0070] Dividing the parent web page into blocks according to a preset height to obtain web page blocks;
[0071] According to the web page link, the sub-web page is scaled down and filled into the web page block, so as to realize data communication between the sub-web page and the parent web page and obtain a communication link.
[0072] In an optional embodiment of the present invention, the preset height may be limited according to the number of sub-pages and the overall height of the parent page. For example, if the number of sub-pages is 2 and the overall height of the parent page is 100, the height of the sub-pages may be limited to 50.
[0073] In the embodiment of the present invention, the sub-web page is embedded into the parent web page through web page segmentation technology, completing the construction of a communication link between the sub-web page and the parent web page, so that users can search in multiple sub-web pages at the same time when searching for problems, thereby expanding the search scope and improving the probability of solving user problems.
[0074] In addition, the step of constructing a communication link between each of the child web pages and the parent web page may also include:
[0075] In response to the transmission request of the child web page, creating a demand request in the child web page, and sending the demand request to the parent web page;
[0076] The parent web page responds to the demand request and transmits the demand data to the child web page to complete the construction of the communication link.
[0077] In the embodiment of the present invention, the transmission request may be a request for the parent web page to transmit the user input information according to the information received by the child web page. The demand request may be a request information for obtaining data in the parent web page, so as to synchronously process the data information input by the user.
[0078] S3. According to the communication link, in the form of message monitoring, each of the sub-web pages synchronously processes the search information input by the user in any sub-web page, so that the parent web page forms a componentized synchronization service architecture.
[0079] In the embodiment of the present invention, the message monitoring refers to the process in which the parent page monitors the information input by the user in any child page. The search information can be the relevant message that the user searches for in any child page according to his / her own needs.
[0080] In the embodiment of the present invention, componentized synchronization is achieved by means of information monitoring, which reduces the delay time of user searches and improves the efficiency of user problem solving.
[0081] In detail, the method adopts the form of message monitoring to synchronously process the search information input by the user in any sub-web page on each sub-web page, including:
[0082] When any of the sub-webpages receives the search information input by the user, the sub-webpage triggers a predefined event instruction to transmit the search information to the parent webpage;
[0083] The parent web page receives the search information and issues event processing instructions to the remaining child web pages according to the search information, thereby achieving synchronous processing of all child pages.
[0084] In the embodiment of the present invention, the event processing instruction may be a search information processing instruction generated by a parent web page according to the received search information.
[0085] In an optional embodiment of the present invention, when the user enters "the effect of calcium on the human body" in the Baidu browser page, the parent web page sends a search instruction for "the effect of calcium on the human body" to another child web page 360 browser page through message monitoring. Therefore, from the user's perspective, the Baidu browser page and the 360 browser page simultaneously process the search instruction for "the effect of calcium on the human body".
[0086] In another optional embodiment of the present invention, when the sub-web pages process the same search information, it is easy for one of the sub-web pages to have eight solutions, while the remaining sub-web pages have only five solutions. At this time, the sub-web pages with more solutions are prone to have their solutions blocked.
[0087] Therefore, in detail, after the parent webpage forms a componentized synchronization service architecture, the method further includes:
[0088] Monitor the actual height of each sub-webpage in real time;
[0089] When the sub-webpage has a content shielding problem, the actual height of the sub-webpage is adjusted using the communication link.
[0090] In the embodiment of the present invention, the actual height of the sub-web page is adjusted in real time, so that the parent web page is optimized and the user experience is improved.
[0091] The front-end component development method proposed in the present invention constructs a parent web page and multiple child web pages, establishes a communication link between each child web page and the parent web page, and based on the communication link, adopts the form of message monitoring to synchronously process the search information entered by the user in any child web page on each child web page, so that the parent web page forms a componentized synchronization service architecture, which can synchronously process the instructions and codes entered by the user, thereby improving the efficiency of web page processing problems.
[0092] like Figure 2 The figure shows a functional module diagram of the front-end component development device of the present invention.
[0093] The front-end component development device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the front-end component development device can include a page construction module 101, a communication link construction module 102 and a synchronization service architecture construction module 103. The module described in the present invention can also be referred to as a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0094] In this embodiment, the functions of each module / unit are as follows:
[0095] The page construction module 101 is used to construct a parent web page and a plurality of child web pages.
[0096] The embodiment of the present invention first constructs a parent web page frame and multiple child web page frames, and constructs pages for the parent web page frame and the child web page frames to obtain the parent web page and multiple child web page pages. The parent web page frame is an overall functional web page frame that can link other child web pages, and the child web page frame is a sub-functional web page frame that can exist in the main web page frame and has certain functions. For example, the Baidu browser web page and the 361 browser web page are linked in a page frame, the page frame is the parent page frame, and the Baidu browser web page and the 361 browser web page are child web page frames. In the embodiment of the present invention, each of the child web page frames can independently realize a given function.
[0097] In detail, the construction of a parent web page and a plurality of child web pages includes:
[0098] Constructing the DOM tree and shadow DOM tree of the parent web page frame and the DOM tree and shadow DOM tree of each child web page frame;
[0099] Setting the page rules of the DOM tree of the parent web page frame to obtain the parent page rules, and setting the page rules of the DOM tree of the child web page frame to obtain the child page rules;
[0100] Constructing a parent page rule document using the parent page rule, and constructing a child page rule document using the child page rule;
[0101] Convert the byte content in the parent page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the parent page rule, and convert the multiple attribute-attribute value pairs in the parent web page frame into tree nodes and link them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame;
[0102] Convert the byte content in the sub-page rule document into characters, and combine them into multiple attribute-attribute value pairs according to the sub-page rule, and convert the multiple attribute-attribute value pairs in the sub-page frame into tree nodes and link them to the DOM tree of the sub-page frame and the shadow DOM tree of the sub-page frame to obtain a complete shadow DOM tree of the sub-page frame;
[0103] According to the complete shadow DOM tree of the parent web page frame, the page of the parent web page frame is drawn using a preset page drawing tool to obtain a parent web page, and according to the complete shadow DOM tree of the child web page frame, the page of the child web page frame is drawn using the page drawing tool to obtain a child web page.
[0104] In the embodiment of the present invention, the DOM tree can be a plurality of code blocks independently written by the user, and the main code blocks and the nested code blocks in the code blocks form a multi-layer tree relationship structure. For example, the main code block of "My Computer" is nested with nested code blocks such as "C Drive" and "D Drive". Furthermore, each drive has many folders, and the folders are nested in folders. The process of opening files layer by layer is equivalent to the process of traversing from the root node to the leaf node. The main body and the nested body constitute a structural relationship tree, which is the DOM tree. The shadow DOM tree is a multi-layer tree structure hidden behind the DOM tree and can complete the functions contained in the DOM tree.
[0105] Furthermore, converting the plurality of attribute-attribute value pairs in the parent web page frame into tree nodes and linking them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame includes:
[0106] Convert the attribute-attribute value pair of the parent web page frame into a CSS tree node in the shadow DOM tree of the parent web page frame;
[0107] Configure the CSS style of each tree node in the shadow DOM tree of the parent web page frame;
[0108] According to the correspondence between each tree node of the shadow DOM tree of the parent web page frame and the CSS tree node, the corresponding CSS tree node is linked to the tree node of the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame.
[0109] In the embodiment of the present invention, the CSS may be a computer language used to express the style of files such as HTML or XML.
[0110] Furthermore, the step of converting the plurality of attribute-attribute value pairs in the child web page into tree nodes and linking them to the DOM tree of the child web page frame and the shadow DOM tree of the child web page frame is the same as the step of converting the plurality of attribute-attribute value pairs in the parent web page frame into tree nodes and linking them to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame, so it will not be repeated here.
[0111] The communication link building module 102 is used to establish a communication link between each of the child web pages and the parent web page.
[0112] In the embodiment of the present invention, the communication link may be a channel for the child web page to share data with the parent web page. Furthermore, both parties building the communication link need to have a common language.
[0113] In an optional embodiment of the present invention, a web page segmentation technology may be used to realize the construction of a communication link between each of the child web pages and the parent web page, wherein the web page segmentation technology may be realized by using div plus css.
[0114] In detail, the construction of a communication link between each of the child web pages and the parent web page includes:
[0115] Obtaining a webpage link of the sub-webpage;
[0116] Dividing the parent web page into blocks according to a preset height to obtain web page blocks;
[0117] According to the web page link, the sub-web page is scaled down and filled into the web page block, so as to realize data communication between the sub-web page and the parent web page and obtain a communication link.
[0118] In an optional embodiment of the present invention, the preset height may be limited according to the number of sub-pages and the overall height of the parent page. For example, if the number of sub-pages is 2 and the overall height of the parent page is 100, the height of each sub-page may be limited to 50.
[0119] In the embodiment of the present invention, the sub-web page is embedded into the parent web page through web page segmentation technology, completing the construction of a communication link between the sub-web page and the parent web page, so that users can search in multiple sub-web pages at the same time when searching for problems, thereby expanding the search scope and improving the probability of solving user problems.
[0120] In addition, the step of constructing a communication link between each of the child web pages and the parent web page may also include:
[0121] In response to the transmission request of the child web page, creating a demand request in the child web page, and sending the demand request to the parent web page;
[0122] The parent web page responds to the demand request and transmits the demand data to the child web page to complete the construction of the communication link.
[0123] In the embodiment of the present invention, the transmission request may be a request for the parent web page to transmit the user input information according to the information received by the child web page. The demand request may be a request information for obtaining data in the parent web page, so as to synchronously process the data information input by the user.
[0124] The synchronous service architecture building module 103 is used to synchronously process the search information input by the user in any sub-web page in the form of message monitoring according to the communication link, so that the parent web page forms a componentized synchronous service architecture.
[0125] In the embodiment of the present invention, the message monitoring refers to the process in which the parent page monitors the information input by the user in any child page. The search information can be the relevant message that the user searches for in any child page according to his / her own needs.
[0126] In the embodiment of the present invention, componentized synchronization is achieved by means of information monitoring, which reduces the delay time of user searches and improves the efficiency of user problem solving.
[0127] In detail, the method adopts the form of message monitoring to synchronously process the search information input by the user in any sub-web page on each sub-web page, including:
[0128] When any of the sub-webpages receives the search information input by the user, the sub-webpage triggers a predefined event instruction to transmit the search information to the parent webpage;
[0129] The parent web page receives the search information and issues event processing instructions to the remaining child web pages according to the search information, thereby achieving synchronous processing of all child pages.
[0130] In the embodiment of the present invention, the event processing instruction may be a search information processing instruction generated by a parent web page according to the received search information.
[0131] In an optional embodiment of the present invention, when the user enters "the effect of calcium on the human body" in the Baidu browser page, the parent web page sends a search instruction for "the effect of calcium on the human body" to another child web page 360 browser page through message monitoring. Therefore, from the user's perspective, the Baidu browser page and the 360 browser page simultaneously process the search instruction for "the effect of calcium on the human body".
[0132] In another optional embodiment of the present invention, when the sub-web pages process the same search information, it is easy for one of the sub-web pages to have eight solutions, while the remaining sub-web pages have only five solutions. At this time, the sub-web pages with more solutions are prone to have their solutions blocked.
[0133] Therefore, in detail, after the parent webpage forms a componentized synchronization service architecture, the method further includes:
[0134] Monitor the actual height of each sub-webpage in real time;
[0135] When the sub-webpage has a content shielding problem, the actual height of the sub-webpage is adjusted using the communication link.
[0136] In the embodiment of the present invention, the actual height of the sub-web page is adjusted in real time, so that the parent web page is optimized and the user experience is improved.
[0137] like Figure 3 The figure is a schematic diagram of the structure of an electronic device for implementing the front-end component development method of the present invention.
[0138] The electronic device may include a processor 10, a memory 11, a communication bus 12 and a communication interface 13, and may also include a computer program stored in the memory 11 and executable on the processor 10, such as a front-end component development program.
[0139] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (for example: SD or DX memory, etc.), magnetic memory, disk, optical disk, etc. The memory 11 may be an internal storage unit of an electronic device in some embodiments, such as a mobile hard disk of the electronic device. The memory 11 may also be an external storage device of an electronic device in other embodiments, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can not only be used to store application software and various types of data installed in the electronic device, such as the code of the front-end component development program, but also can be used to temporarily store data that has been output or is to be output.
[0140] The processor 10 may be composed of an integrated circuit in some embodiments, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips, etc. The processor 10 is the control core (Control Unit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules (such as front-end component development programs, etc.) stored in the memory 11, and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0141] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. The communication bus 12 is configured to realize connection and communication between the memory 11 and at least one processor 10, 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.
[0142] Figure 3 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 3 The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0143] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0144] Optionally, the communication interface 13 may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices.
[0145] Optionally, the communication interface 13 may also include a user interface, which may be a display, an input unit (such as a keyboard), or a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode) touch device. The display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0146] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0147] The front-end component development program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0148] Build a parent web page and multiple child web pages;
[0149] Establishing a communication link between each of the child web pages and the parent web page;
[0150] According to the communication link, in the form of message monitoring, the search information input by the user in any sub-web page is synchronously processed in each of the sub-web pages, so that the parent web page forms a componentized synchronization service architecture.
[0151] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0152] Furthermore, if the module / unit integrated in the electronic device 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. The computer-readable medium can be non-volatile or volatile. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM).
[0153] An embodiment of the present invention may further provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor of an electronic device, the computer program may implement:
[0154] Build a parent web page and multiple child web pages;
[0155] Establishing a communication link between each of the child web pages and the parent web page;
[0156] According to the communication link, in the form of message monitoring, the search information input by the user in any sub-web page is synchronously processed in each of the sub-web pages, so that the parent web page forms a componentized synchronization service architecture.
[0157] Furthermore, the computer-usable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.
[0158] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0159] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on 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.
[0160] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, 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 hardware plus software functional modules.
[0161] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0162] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0163] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0164] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0165] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0166] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. A front-end component development method, characterized in that: The method comprises: Build a parent web page and multiple child web pages; Establishing a communication link between each of the child web pages and the parent web page; According to the communication link, in the form of message monitoring, each of the sub-webpages synchronously processes the search information input by the user in any sub-webpage, so that the parent webpage forms a componentized synchronization service architecture; The method of constructing a parent web page and multiple child web pages includes: constructing a DOM tree and a shadow DOM tree of a parent web page frame, and constructing a DOM tree and a shadow DOM tree of each child web page frame, wherein the parent web page frame is an overall functional web page frame that links other child web pages, and the child web page frame is a child functional web page frame that exists in the parent web page frame and has certain functions; setting page rules of the DOM tree of the parent web page frame to obtain parent page rules, and setting page rules of the DOM tree of the child web page frame to obtain child page rules; constructing a parent page rule document using the parent page rules, and constructing a child page rule document using the child page rules; converting the byte content in the parent page rule document into characters, and combining them into multiple attribute-attribute value pairs according to the parent page rules, and converting multiple attribute-attribute value pairs in the parent web page frame into characters. The property-attribute value pairs are converted into tree nodes and then linked to the DOM tree of the parent web page frame and the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame; the byte content in the child page rule document is converted into characters, and combined into multiple property-attribute value pairs according to the child page rules, and multiple property-attribute value pairs in the child web page frame are converted into tree nodes and then linked to the DOM tree of the child web page frame and the shadow DOM tree of the child web page frame to obtain a complete shadow DOM tree of the child web page frame; according to the complete shadow DOM tree of the parent web page frame, a page of the parent web page frame is drawn using a preset page drawing tool to obtain a parent web page, and according to the complete shadow DOM tree of the child web page frame, a page of the child web page frame is drawn using the page drawing tool to obtain a child web page.
2. The front-end component development method according to claim 1, characterized in that: The converting the plurality of attribute-attribute value pairs in the parent webpage frame into tree nodes and then linking them to the DOM tree of the parent webpage frame and the shadow DOM tree of the parent webpage frame to obtain a complete shadow DOM tree of the parent webpage frame includes: Convert the attribute-attribute value pair of the parent web page frame into a CSS tree node in the shadow DOM tree of the parent web page frame; Configure the CSS style of each tree node in the shadow DOM tree of the parent web page frame; According to the correspondence between each tree node of the shadow DOM tree of the parent web page frame and the CSS tree node, the corresponding CSS tree node is linked to the tree node of the shadow DOM tree of the parent web page frame to obtain a complete shadow DOM tree of the parent web page frame.
3. The front-end component development method according to claim 1, characterized in that: The step of establishing a communication link between each of the child web pages and the parent web page includes: Obtaining a webpage link of the sub-webpage; Dividing the parent web page into blocks according to a preset height to obtain web page blocks; According to the web page link, the sub-web page is scaled down and filled into the web page block, so as to realize data communication between the sub-web page and the parent web page and obtain a communication link.
4. The front-end component development method according to claim 1, characterized in that: The step of establishing a communication link between each of the child web pages and the parent web page includes: In response to the transmission request of the child web page, creating a demand request in the child web page, and sending the demand request to the parent web page; The parent web page responds to the demand request and transmits the demand data to the child web page to complete the construction of the communication link.
5. The front-end component development method according to claim 1, characterized in that: The method adopts the form of message monitoring to synchronously process the search information input by the user in any sub-web page on each sub-web page, including: When any of the sub-webpages receives the search information input by the user, the sub-webpage triggers a predefined event instruction to transmit the search information to the parent webpage; The parent web page receives the search information and issues event processing instructions to other child web pages according to the search information.
6. The front-end component development method according to any one of claims 1 to 5, characterized in that: After the parent webpage is formed into a componentized synchronization service architecture, the method further includes: Monitor the actual height of each sub-webpage in real time; When the sub-webpage has a content shielding problem, the actual height of the sub-webpage is adjusted using the communication link.
7. A front-end component development device, used to implement the front-end component development method according to any one of claims 1 to 6, characterized in that: include: A page building module is used to build a parent web page and multiple child web pages; A communication link building module, used to establish a communication link between each of the child web pages and the parent web page; The synchronous service architecture building module is used to synchronously process the search information input by the user in any sub-web page in the form of message monitoring according to the communication link, so that the parent web page forms a componentized synchronous service architecture.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores computer program instructions that can be executed by the at least one processor, and the computer program instructions are executed by the at least one processor to enable the at least one processor to execute the front-end component development method as described in any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the front-end component development method as described in any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Page generation method and device, electronic equipment and storage medium
CN111124379A
Page test method, device, equipment, and computer readable storage medium
CN111831571A
