CN116149757B - Plug-in virtual route realization method, device, computer equipment and storage medium - Google Patents
Plug-in virtual route realization method, device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN116149757B CN116149757B CN202310400538.0A CN202310400538A CN116149757B CN 116149757 B CN116149757 B CN 116149757B CN 202310400538 A CN202310400538 A CN 202310400538A CN 116149757 B CN116149757 B CN 116149757B
- Authority
- CN
- China
- Prior art keywords
- information
- plug
- route
- page
- browser
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 49
- 230000008859 change Effects 0.000 claims abstract description 115
- 238000012544 monitoring process Methods 0.000 claims abstract description 18
- 230000009191 jumping Effects 0.000 claims abstract description 7
- 238000004590 computer program Methods 0.000 claims description 7
- 230000004044 response Effects 0.000 abstract description 7
- 230000006870 function Effects 0.000 description 4
- 238000012545 processing Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 2
- 238000001514 detection method Methods 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000011897 real-time detection Methods 0.000 description 2
- 230000009471 action Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 235000019800 disodium phosphate Nutrition 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000004672 jump response Effects 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000009877 rendering Methods 0.000 description 1
- 238000012827 research and development Methods 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
- G06F9/44526—Plug-ins; Add-ons
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/50—Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The embodiment of the application belongs to the technical field of virtual routing, and relates to a plug-in virtual routing realization method, which comprises the steps of initializing a micro front end slot and generating virtual routing information; initializing virtual routing information; the current position information and the conversation history information of each plug-in are proxied; monitoring the browser in real time; when the current route information of the browser is inconsistent with the initial route information, updating the virtual route information and obtaining route change information; the route change information is sent to the target plug-in, so that the target plug-in obtains updated virtual route information and performs page jumping; and after the page skip is completed, storing the updated route information of the target plug-in into the query parameters of the browser so as to display the updated route address of the plug-in. The application also provides a plug-in virtual route realization device, computer equipment and a storage medium. The method and the device can effectively solve the problem of disordered plug-in response time sequence caused by frequently splicing page information.
Description
Technical Field
The present invention relates to the field of virtual routing technologies, and in particular, to a method, an apparatus, a computer device, and a storage medium for implementing a plug-in virtual routing.
Background
In order to meet the personalized customization demands of clients, the existing research and development management tool generally provides an open system platform for users to write plug-ins to realize various customized functions, and the execution mechanism of the plug-ins is mainly to match the plug-in modules to corresponding plug-in modules through routes, and then initialize, mount and the like the plug-ins.
When the plug-in unit is actually used, as the plug-in unit belongs to an independent application and is internally provided with a routing system to control page skip in the plug-in unit, when the page in the plug-in unit needs to be skipped from a system platform, the page information of the current page needs to be transmitted to the plug-in unit through the system, and then the page information is spliced to the plug-in unit through a component tool kit of a tool library to realize the page skip of the plug-in unit.
However, since the system platform has a plurality of plug-ins corresponding to the system platform, when the plug-ins with different functions are switched, the page information of the current page needs to be acquired again for splicing, and the operation is troublesome. Meanwhile, when a plurality of users access different plugins at the same time, page information needs to be frequently acquired and spliced, and the operation can lead the system to be easily disordered in time sequence, so that the problem of wrong page jump response of the plugins occurs.
Disclosure of Invention
The embodiment of the application aims to provide a method, a device, computer equipment and a storage medium for realizing plug-in virtual routing, so as to solve the problem of plug-in response time sequence disorder caused by frequently splicing page information.
In order to solve the above technical problems, the embodiments of the present application provide a method for implementing a plug-in virtual route, which adopts the following technical scheme:
initializing a micro front end slot for connecting the browser with each plug-in unit to generate virtual routing information;
acquiring initial route information of a current page of a browser, and initializing the virtual route information according to the initial route information;
the current position information and the conversation history information of each plug-in are proxied to acquire the route information of the current page of each plug-in and store the route information into the virtual route information;
monitoring the route information of the browser in real time;
when the current route information of the browser is inconsistent with the initial route information, receiving the current route information and updating the route information of the corresponding plugin in the virtual route information to obtain route change information, wherein the route change information comprises plugin name data and page change events;
The route change information is sent to a target plugin corresponding to the plugin name data, so that when the target plugin receives the page change event, updated virtual route information is obtained, and page skip is carried out according to the virtual route information; and
And after the target plug-in completes the page skip, storing the updated route information of the target plug-in into the query parameters of the browser so as to display the updated route address of the plug-in.
Further, when the current routing information of the browser is inconsistent with the initial routing information, receiving the current routing information and updating the routing information of the corresponding plugin in the virtual routing information to obtain routing change information, where the routing change information includes plugin name data and a page change event, and specifically includes:
when the current route information of the browser is inconsistent with the initial route information, acquiring the current route information of the browser, and identifying and intercepting access route information which accesses the plug-in the current route information;
updating the route information of the corresponding plug-in the virtual route information according to the intercepted access route information; and
And generating the route change information after the route information of the plug-in is updated.
Further, the step of sending the route change information to a target plugin corresponding to the plugin name data, so that the target plugin obtains the updated virtual route information when receiving the page change event, and performs page skip according to the virtual route information specifically includes:
identifying plug-in name data in the routing change information and sending the routing change information to a target plug-in corresponding to the plug-in name data;
when the target plug-in receives the route change information, identifying a page change event in the route change information, and acquiring updated virtual route information; and
And jumping the page of the target plugin according to the acquired routing information address of the updated plugin in the virtual routing information.
Further, after the target plug-in completes the page skip, the step of storing the updated routing information of the target plug-in into the query parameter of the browser to display the updated routing address of the plug-in specifically includes:
Detecting whether the target plug-in completes page skip in real time;
the routing information of the target plug-in after the page jump is completed is sent to the query parameters of the browser to be stored; and
And identifying the route address in the route information of the target plug-in and displaying the route address in the browser.
Further, after the step of sending the route information of the target plugin after completing the page skip to the query parameter of the browser for saving, the method further includes:
and when the route information of the target plugin is changed, generating a plugin page change event, and sending the plugin page change event to the browser.
Further, after the step of storing the updated routing information of the target plugin into the query parameter of the browser to display the plugin routing address after the target plugin completes the page skip, the method further includes:
detecting whether the plug-in page is changed in real time;
when the plug-in page is detected to be changed, the routing information of the changed plug-in is sent to the query parameters of the browser to be stored.
Further, the current location information is a location object, the session history information is a history object, the Proxy is a Proxy object in JavaScript, and the Proxy object is used for intercepting routing information sent when the browser accesses the plug-in and performing a custom operation on the location object and the history object of the Proxy.
In order to solve the above technical problem, an embodiment of the present application further provides a device for implementing a plug-in virtual route, including:
the first initialization module is used for initializing the micro front end slot for connecting the browser with each plug-in unit and generating virtual routing information;
the second initialization module is used for acquiring initial route information of a page where the browser is currently located, and initializing the virtual route information according to the initial route information;
the proxy module is used for proxy to the current position information and the conversation history information of each plug-in, obtaining the route information of the current page of each plug-in and storing the route information into the virtual route information;
the monitoring module is used for monitoring the route information of the browser in real time;
the updating module is used for receiving the current routing information and updating the routing information of the corresponding plugin in the virtual routing information when the current routing information of the browser is inconsistent with the initial routing information, so as to obtain routing change information, wherein the routing change information comprises plugin name data and page change events;
the page jump module is used for sending the route change information to a target plugin corresponding to the plugin name data, so that the target plugin obtains the updated virtual route information when receiving the page change event, and carries out page jump according to the virtual route information; and
And the information storage module is used for storing the updated route information of the target plug-in into the query parameters of the browser after the target plug-in finishes the page skip so as to display the updated route address of the plug-in.
In order to solve the above technical problems, the embodiments of the present application further provide a computer device, which adopts the following technical schemes:
a computer device comprising a memory and a processor, said memory having stored therein a computer program, said processor implementing the steps of the plug-in virtual routing implementation method described above when said computer program is executed.
In order to solve the above technical problems, embodiments of the present application further provide a computer readable storage medium, which adopts the following technical solutions:
a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the plug-in virtual routing implementation method described above.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
according to the plug-in virtual route implementation method, virtual routes are formed by connecting the micro front-end slot with the browser and each plug-in and initializing. Initializing the virtual routing information through the information of the current page of the browser, and proxy the current position information and session history information of each plug-in to form initial virtual routing information. By monitoring the route information of the browser, when the route information of the browser is monitored to change, the route information of the browser is received, the plug-in unit route information of the agent in the virtual route information is updated according to the route information, route change information is generated after updating, the update is sent to a corresponding target plug-in unit for notification, and the target plug-in unit after receiving the route change information acquires the updated plug-in unit route information from the virtual route information for corresponding page skip. Finally, by storing the route information of the target plug-in into the query parameters of the browser, the access of the browser to the plug-in does not need to manually splice the page information and the route of the plug-in, and the subsequent re-browser can conveniently access the plug-in again. Through the method, the browser and the plug-in can be effectively decoupled, and meanwhile, the problem that page information of the browser and the plug-in need to be spliced when the plug-in is accessed to perform page skip is avoided, so that the problem of disorder of response time sequence of the plug-in caused by frequent page information splicing is effectively solved.
Drawings
For a clearer description of the solution in the present application, a brief description will be given below of the drawings that are needed in the description of the embodiments of the present application, it being obvious that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flow chart of one embodiment of a plug-in virtual routing implementation method according to the present application;
FIG. 2 is a flow chart of one embodiment of step S50 of FIG. 1;
FIG. 3 is a flow chart of one embodiment of step S60 of FIG. 1;
FIG. 4 is a flow chart of one embodiment of step S70 of FIG. 1;
FIG. 5 is a schematic diagram illustrating one embodiment of a plug-in virtual routing implementation apparatus in accordance with the present application;
FIG. 6 is a schematic structural diagram of one embodiment of a computer device according to the present application.
Description of the embodiments
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description and claims of the present application and in the description of the figures above are intended to cover non-exclusive inclusions. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to better understand the technical solutions of the present application, the following description will clearly and completely describe the technical solutions in the embodiments of the present application with reference to the accompanying drawings.
Referring to fig. 1, a flow chart of one embodiment of a plug-in virtual routing implementation method according to the present application is shown. The plug-in virtual route implementation method comprises the following steps:
s10, initializing a micro front end slot for connecting a browser with each plug-in unit, and generating virtual routing information;
in this embodiment, the slots of the micro front end are connected with a plurality of plug-ins and a browser, the browser is a display page arranged on the system, and in specific implementation, the display page on the system is a default display page which can be set, after the browser and the plug-ins are connected through the slots, the slots of the micro front end are initialized so as to ensure that the browser and all the plug-ins are effectively connected with the slots of the micro front end, thereby realizing the establishment of an effective data transmission channel between the slots and the browser and between the plug-ins. Through setting up little front end slot, can conveniently uninstall and install the plug-in components to improve the flexibility of system.
S20, obtaining initial route information of a current page of a browser, and initializing virtual route information according to the initial route information;
in this embodiment, when the browser displays the main page of the system, corresponding address information is displayed, and the virtual routing information is initialized by the address information, so that the address information is effectively saved in the virtual routing information, so as to perform comparison when monitoring the system page.
S30, proxy is carried out on the current position information and the conversation history information of each plug-in, and the route information of the page where each plug-in is currently located is obtained and stored in the virtual route information;
in this embodiment, the current location information is a location object, the session history information is an hsitrate object, and the Proxy is performed by a Proxy object in JavaScript, and the virtual routing information effectively obtains the routing information of the current page of the plug-in by Proxy to the location of the plug-in and the hsitrate object and initializing the routing information of the current plug-in page to the location of the Proxy and the hsitrate object.
S40, monitoring the route information of the browser in real time;
in this embodiment, the monitoring of the browser is performed by a JavaScript monitoring function, and the monitoring function may also monitor the routing information of the plug-in real time, in addition to monitoring the routing information of the browser in real time.
S50, when the current route information of the browser is inconsistent with the initial route information, receiving the current route information and updating the route information of the corresponding plugin in the virtual route information to obtain route change information, wherein the route change information comprises plugin name data and a page change event;
in this embodiment, when a user clicks a plug-in on a system page to access the plug-in, a corresponding access request is added to the initial route information of the browser to form current route information of the browser, so that the current route information of the browser changes, and the change of the route information of the browser can be obtained through the above monitoring step. When the current route information is received, the current route information needs to be analyzed to identify corresponding plug-in name data, and the route information of the corresponding plug-in stored in the virtual route information is connected with the initial route information of the browser through the plug-in name data so as to update the virtual route information, so that the splicing between the page information of the browser and the plug-in information can be completed in the virtual route. After the update of the virtual routing information is completed, add the plug-in name data to the page change event as a prefix, so that the situation of transmission errors is effectively avoided when the page change event is transmitted, the page change event is event information automatically generated by a system when the routing information of the acquired browser changes, and the plug-in is effectively informed to acquire the updated virtual routing information by transmitting the page change information to the corresponding plug-in.
S60, the route change information is sent to a target plugin corresponding to the plugin name data, so that when the target plugin receives the page change event, updated virtual route information is obtained, and page skip is carried out according to the virtual route information; and
In this embodiment, the plugin may identify and detect the page change event in real time, and when the plugin receives the page change event, the plugin obtains the routing information of the plugin corresponding to the update from the virtual routing information according to the plugin data name prefix added on the page change event, so as to perform the action of page skip.
And S70, after the target plug-in completes the page skip, storing the updated route information of the target plug-in into the query parameters of the browser so as to display the plug-in route address.
In this embodiment, after the target plug-in completes the page skip, the routing address of the target plug-in needs to be displayed on the address bar of the browser page to form a corresponding information display. By storing the route information of the target plug-in after completing the page skip into the query parameters of the browser, the route address of the plug-in can be effectively added to the address of the browser page for corresponding display. Meanwhile, in the process of storing the plug-in routing information, due to some special conditions, after the target plug-in completes the page skip, the situation that the plug-in routing information is lost and the routing address of the plug-in is not displayed may occur, and at this time, the system is required to actively synchronize the plug-in routing information of the target plug-in to the address of the browser to complete corresponding address addition, so that the display of the plug-in address on the browser is realized.
In this embodiment, the virtual route is formed by connecting the micro front-end slot with the browser and each plug-in and initializing. Initializing the virtual routing information through the information of the current page of the browser, and proxy the current position information and session history information of each plug-in to form initial virtual routing information. By monitoring the route information of the browser, when the route information of the browser is monitored to change, the route information of the browser is received, the plug-in unit route information of the agent in the virtual route information is updated according to the route information, route change information is generated after updating, the update is sent to a corresponding target plug-in unit for notification, and the target plug-in unit after receiving the route change information acquires the updated plug-in unit route information from the virtual route information for corresponding page skip. Finally, by storing the route information of the target plug-in into the query parameters of the browser, the access of the browser to the plug-in does not need to manually splice the page information and the route of the plug-in, and the subsequent re-browser can conveniently access the plug-in again. Through the method, the browser and the plug-in can be effectively decoupled, and meanwhile, the problem that page information of the browser and the plug-in need to be spliced when the plug-in is accessed to perform page skip is avoided, so that the problem of disorder of response time sequence of the plug-in caused by frequent page information splicing is effectively solved.
In this embodiment, implementation of the method is performed by JavaScript, location and hsity objects of each plug-in can be effectively proxied through Proxy objects of the JavaScript, meanwhile, sending of the route change information is performed by performing a dispatchevent () method in the JavaScript to perform corresponding event dispatch to a specified target, plug-in name data corresponds to a plugin name in the JavaScript, a page change event corresponds to a popstate event of the JavaScript, a query parameter is a query parameter, and the initialization operations are all performed by the JavaScript.
By the method, the page skip between the plug-in and the browser and between the plug-in and other plug-ins can be realized, when the plug-in is required to control the browser to skip the page, the current route information change of the plug-in is correspondingly obtained, the browser route information in the virtual route information is updated according to the changed plug-in route information, and the route change information is regenerated and sent to the page of the browser to skip the page. Similarly, when the current plugin needs to control other plugins to perform page skip, the operation steps are correspondingly updated in the virtual routing information, and then the routing change information is sent to the corresponding plugins to perform event triggering so as to acquire the updated virtual routing information. Because the route information of the browser and each plug-in is spliced in the virtual route and then sent, the browser information and the plug-in information in the virtual route information are changed for the browser and each plug-in, and the browser and each plug-in cannot be influenced, so that the influence of data errors on the browser and the plug-in is effectively avoided. Meanwhile, as the information change of the browser and the plugin occurs in the virtual routing information, a user can also carry out page skip on the browser through the plugin or carry out page skip on other plugins through a certain plugin, and the browser or the plugin cannot be influenced.
With continued reference to FIG. 2, a flowchart of one particular embodiment of step S50 is shown, comprising the steps of:
s501, when the current route information of the browser is inconsistent with the initial route information, acquiring the current route information of the browser, and identifying and intercepting access route information accessed by the plug-in the current route information;
s502, updating the route information of the corresponding plug-in the virtual route information according to the intercepted access route information; and
S503, generating the route change information after the route information of the plug-in is updated.
According to the embodiment, the current route information of the browser is obtained, the access route information in the current browse information is identified, the plug-in route information in the virtual route information can be updated according to the access route information, and the plug-in can perform corresponding page skip conveniently when the virtual route information is obtained. By generating the route change information when the updating of the plug-in route information is completed, the plug-in can be effectively notified, so that the plug-in can acquire the virtual route information in time.
With continued reference to FIG. 3, a flowchart of one particular embodiment of step S60 is shown, comprising the steps of:
S601, identifying plug-in name data in the route change information and sending the route change information to a target plug-in corresponding to the plug-in name data;
s602, when the target plug-in receives the route change information, identifying a page change event in the route change information, and acquiring updated virtual route information; and
S603, jumping the page of the target plug-in according to the updated route information address of the plug-in the obtained virtual route information.
According to the method and the device, the route change information can be accurately sent to the corresponding target plugin according to the plugin name by identifying the plugin name data in the route change information, and the step of acquiring the virtual route information can be accurately triggered according to the page change event by identifying the page change event in the route change information, so that the page of the plugin can be jumped after the virtual route information is acquired.
With continued reference to FIG. 4, a flowchart of one particular embodiment of step S70 is shown, comprising the steps of:
s701, detecting whether the target plug-in completes page jumping in real time;
s702, sending the route information of the target plug-in after completing page skip to the query parameters of the browser for storage; and
S703, identifying the route address in the route information of the target plug-in and displaying the route address in the browser.
According to the embodiment, the target plug-in can be effectively determined to accurately complete the page skip by detecting the page skip completion of the target plug-in, so that the effective route information of the target plug-in is sent to the query parameters of the browser to be stored, and the correct plug-in route address is displayed in the browser.
After step S702, the method further includes the steps of:
and when the route information of the target plugin is changed, generating a plugin page change event, and sending the plugin page change event to the browser.
According to the embodiment, when the route information of the target plug-in is changed, the page change event of the plug-in is generated, and the page change event is sent to the browser, so that the browser can be effectively informed that the target plug-in has completed the page skip, and the browser can accurately display the plug-in route address.
After step S70, the method further comprises the steps of:
detecting whether the plug-in page is changed in real time;
when the plug-in page is detected to be changed, the routing information of the changed plug-in is sent to the query parameters of the browser to be stored.
In this embodiment, the foregoing real-time detection of the plug-in page is implemented by monitoring the current routing information of the plug-in through the system, and in a specific implementation, the embodiment may monitor the current routing information of each plug-in addition to the current routing information of the browser, so that when a user controls the browser or other plug-ins to perform page skip through the plug-in, the virtual routing information may be effectively updated. The plug-in name data and the page change event correspond to a pluginName event and a popstate event in JavaScript, and the route change information is a { { pluginName } } } } } -popstate event. The sending of the route change information is completed by performing a dispatch operation by an EventTarget.dispatchEvent () method in the JavaScript to send a corresponding event to a designated target, and because the route change information is { { pluginName } } } -popstate event, the dispatchc operation can directly send the route change information to a target plug-in corresponding to the pluginName, and meanwhile, after the target plug-in completes page skip, a popstate event is also generated, and at the moment, the JavaScript also calls a dispatchc command to send the popstate event into a browser to inform the browser that the page skip of the target plug-in is completed, so that the next operation is continued.
According to the method and the device for updating the plug-in page, through real-time detection of the plug-in page, when the plug-in page is changed, the route information of the plug-in can be timely stored in the query parameters of the browser, so that after the plug-in page is updated to change, the route address information of the plug-in stored in the browser can be timely and effectively updated, and the subsequent browser can conveniently access the plug-in again.
In an optional embodiment of this embodiment, the current location information is a location object, the session history information is a history object, and the Proxy is a Proxy object in JavaScript, where the Proxy object is configured to intercept routing information sent when the browser accesses the plug-in, and perform a custom operation on the location object and the history object of the Proxy.
In this embodiment, the Proxy to the plug-in location object and the history object is completed through the Proxy object in the JavaScript, and after the Proxy object in the JavaScript proxies the location object and the history object of the plug-in, the browser recognizes and intercepts the route information requested when accessing the plug-in, and then updates the location object and the history object through the custom operation set in the JavaScript.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a computer-readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
With further reference to fig. 5, as an implementation of the method shown in fig. 1, the application provides an embodiment of a plug-in virtual route implementation apparatus, where an embodiment of the apparatus corresponds to the embodiment of the method shown in fig. 1, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, the plug-in virtual route implementation apparatus 8 according to the present embodiment includes: a first initialization module 801, a second initialization module 802, a proxy module 803, a listening module 804, an updating module 805, a page skip module 806, and an information holding module 807. Wherein:
a first initialization module 801, configured to initialize a micro front-end slot that connects a browser and each plug-in, and generate virtual routing information;
a second initialization module 802, configured to obtain initial routing information of a page where a browser is currently located, and initialize virtual routing information according to the initial routing information;
the proxy module 803 is configured to proxy the current location information and session history information of each plug-in, obtain the route information of the page where each plug-in is currently located, and store the route information in the virtual route information;
a monitoring module 804, configured to monitor the route information of the browser in real time;
An updating module 805, configured to receive current routing information of the browser and update routing information of a corresponding plugin in the virtual routing information when the current routing information is inconsistent with the initial routing information, so as to obtain routing change information, where the routing change information includes plugin name data and a page change event;
a page-skip module 806, configured to send the route change information to a target plugin corresponding to the plugin name data, so that when the target plugin receives the page change event, the target plugin obtains updated virtual route information, and performs page skip according to the virtual route information; and
And an information saving module 807, configured to save, after the target plug-in completes the page skip, the route information updated by the target plug-in to the query parameter of the browser, so as to display the route address updated by the plug-in.
In this embodiment, through the system module corresponding to the plug-in virtual route implementation method, the problem of disorder of response time sequence of the plug-in caused by frequently splicing page information can be effectively solved.
In an alternative embodiment of the present embodiment, the update module includes: the system comprises an identification sub-module, an updating sub-module and an information generation sub-module. Wherein:
The identification sub-module is used for acquiring the current route information of the browser and identifying the access route information of the plug-in the current route information when the current route information of the browser is inconsistent with the initial route information;
the updating sub-module is used for updating the route information of the corresponding plug-in the virtual route information according to the identified access route information; and
And the information generation sub-module is used for generating the route change information after the route information of the plug-in is updated.
According to the embodiment, the identification sub-module is arranged, so that the current route information of the browser can be compared with the initial route information, and the access route information of the plug-in the current route information can be effectively identified. By arranging the updating sub-module, the routing information of the plugin corresponding to the access routing information in the virtual routing information can be updated in real time effectively according to the identified access routing information. Through the setting information generation sub-module, the route change information comprising the plug-in name data and the page change event can be generated after the virtual route information is updated, so that the plug-in can conveniently acquire the virtual route information according to the route change information.
In an alternative embodiment of the present embodiment, the page skip module includes: the device comprises a sending sub-module, an obtaining sub-module and a rotor jumping module. Wherein: a transmitting sub-module, configured to identify plug-in name data in the route change information and transmit the route change information to a target plug-in corresponding to the plug-in name data;
the acquisition sub-module is used for identifying a page change event in the route change information when the target plug-in receives the route change information, and acquiring updated virtual route information; and
And the jump rotor module is used for jumping the page of the target plug-in according to the obtained updated route information address of the plug-in the virtual route information.
According to the embodiment, the sending sub-module is arranged, so that the card name data in the route change information can be effectively identified, and the route change information can be sent to the corresponding target card according to the identified card name data. By arranging the acquisition sub-module, after the target plug-in receives the route change information, whether the route change information contains a page change event or not can be detected, and when the event containing the page change event is detected, updated virtual route information is acquired. By arranging the jump rotor module, the plug-in routing information address in the updated virtual routing information can be effectively resolved, so that the plug-in is controlled to carry out page jump.
In an alternative embodiment of the present embodiment, the information saving module includes:
the detection sub-module is used for detecting whether the target plug-in completes page skip in real time;
the storage sub-module is used for sending the route information of the target plug-in after the page jump is completed to the query parameters of the browser for storage;
and the display sub-module is used for identifying the route address in the route information of the target plug-in and displaying the route address in the browser.
According to the embodiment, whether the target plug-in successfully completes the page skip can be effectively detected by arranging the detection sub-module for detecting whether the target plug-in completes the page skip in real time, so that feedback and processing can be timely carried out on the condition that the target plug-in fails to successfully skip due to the occurrence of the page skip error in the target plug-in. By setting the storing submodule for storing the routing information of the plug-in into the query parameters of the browser, the routing information of the plug-in can be stored correspondingly. The display sub-module is used for identifying the routing information of the plug-in and displaying the acquired routing address on the browser page, so that the plug-in routing address after the page is jumped can be displayed on the browser page, and the rendering of the plug-in routing address on the browser page is realized.
In order to solve the technical problems, the embodiment of the application also provides computer equipment. Referring specifically to fig. 6, fig. 6 is a basic structural block diagram of a computer device according to the present embodiment.
The computer device 9 comprises a memory 91, a processor 92, a network interface 93 communicatively connected to each other via a system bus. It should be noted that only computer device 9 having components 91-93 is shown in the figures, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be appreciated by those skilled in the art that the computer device herein is a device capable of automatically performing numerical calculations and/or information processing in accordance with predetermined or stored instructions, the hardware of which includes, but is not limited to, microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASICs), programmable gate arrays (fields-Programmable Gate Array, FPGAs), digital processors (Digital Signal Processor, DSPs), embedded devices, etc.
The computer equipment can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The computer equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 91 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the storage 91 may be an internal storage unit of the computer device 9, such as a hard disk or a memory of the computer device 9. In other embodiments, the memory 91 may also be an external storage device of the computer device 9, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the computer device 9. Of course, the memory 91 may also comprise both an internal memory unit of the computer device 9 and an external memory device. In this embodiment, the memory 91 is generally used to store an operating system and various application software installed on the computer device 9, such as program codes of a plug-in virtual routing implementation method, and the like. Further, the memory 91 may be used to temporarily store various types of data that have been output or are to be output.
The processor 92 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 92 is typically used to control the overall operation of the computer device 9. In this embodiment, the processor 92 is configured to execute a program code stored in the memory 91 or process data, for example, a program code for executing the plug-in virtual routing implementation method.
The network interface 93 may comprise a wireless network interface or a wired network interface, which network interface 93 is typically used to establish a communication connection between the computer device 9 and other electronic devices.
According to the computer equipment, the browser and the plug-in can be effectively decoupled, and meanwhile, the problem that page information of the browser and the plug-in need to be spliced when the plug-in is accessed to perform page skip is avoided, so that the problem that response time sequence of the plug-in is disordered due to frequent splicing of the page information is effectively solved.
The present application also provides another embodiment, namely, a computer-readable storage medium storing a plug-in virtual route implementation program, where the plug-in virtual route implementation program is executable by at least one processor, so that the at least one processor performs the steps of the plug-in virtual route implementation method as described above.
The computer readable storage medium can effectively decouple the browser from the plug-in, and meanwhile avoids the problem that page information of the browser and the plug-in need to be spliced when the plug-in is accessed to perform page skip, so that the problem that the response time sequence of the plug-in is disordered due to frequent splicing of the page information is effectively solved.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk), comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method described in the embodiments of the present application.
It is apparent that the embodiments described above are only some embodiments of the present application, but not all embodiments, the preferred embodiments of the present application are given in the drawings, but not limiting the patent scope of the present application. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a more thorough understanding of the present disclosure. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing, or equivalents may be substituted for elements thereof. All equivalent structures made by the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the protection scope of the application.
Claims (10)
1. The plug-in virtual route implementation method is characterized by comprising the following steps:
initializing a micro front end slot for connecting the browser with each plug-in unit to generate virtual routing information;
acquiring initial route information of a current page of a browser, and initializing the virtual route information according to the initial route information;
the current position information and the conversation history information of each plug-in are proxied to acquire the route information of the current page of each plug-in and store the route information into the virtual route information;
monitoring the route information of the browser in real time;
when the current route information of the browser is inconsistent with the initial route information, receiving the current route information and updating the route information of the corresponding plugin in the virtual route information to obtain route change information, wherein the route change information comprises plugin name data and page change events;
the route change information is sent to a target plugin corresponding to the plugin name data, so that when the target plugin receives the page change event, updated virtual route information is obtained, and page skip is carried out according to the virtual route information; and
And after the target plug-in completes the page skip, storing the updated route information of the target plug-in into the query parameters of the browser so as to display the updated route address of the plug-in.
2. The method for implementing the virtual routing of the plugin according to claim 1, wherein when the current routing information of the browser is inconsistent with the initial routing information, the method receives the current routing information and updates the routing information of the corresponding plugin in the virtual routing information to obtain routing change information, where the routing change information includes plugin name data and a page change event, and specifically includes:
when the current route information of the browser is inconsistent with the initial route information, acquiring the current route information of the browser, and identifying and intercepting access route information which accesses the plug-in the current route information;
updating the route information of the corresponding plug-in the virtual route information according to the intercepted access route information; and
And generating the route change information after the route information of the plug-in is updated.
3. The method for implementing a virtual routing of a plugin according to claim 1, wherein the step of sending the routing change information to a target plugin corresponding to the plugin name data, so that the target plugin obtains the updated virtual routing information when receiving the page change event, and performs a page jump according to the virtual routing information specifically includes:
Identifying plug-in name data in the routing change information and sending the routing change information to a target plug-in corresponding to the plug-in name data;
when the target plug-in receives the route change information, identifying a page change event in the route change information, and acquiring updated virtual route information; and
And jumping the page of the target plugin according to the acquired routing information address of the updated plugin in the virtual routing information.
4. The method for implementing plug-in virtual routing according to claim 1, wherein the step of storing the updated routing information of the target plug-in the query parameter of the browser to display the updated routing address of the plug-in after the target plug-in completes the page skip specifically includes:
detecting whether the target plug-in completes page skip in real time;
the routing information of the target plug-in after the page jump is completed is sent to the query parameters of the browser to be stored; and
And identifying the route address in the route information of the target plug-in and displaying the route address in the browser.
5. The method for implementing plug-in virtual routing according to claim 4, wherein after the step of sending the routing information of the target plug-in after completing the page jump to the query parameter of the browser for saving, the method further comprises:
And when the route information of the target plugin is changed, generating a plugin page change event, and sending the plugin page change event to the browser.
6. The method for implementing plug-in virtual routing according to claim 1, wherein after the step of storing the routing information updated by the target plug-in the query parameter of the browser to display a plug-in routing address after the target plug-in completes the page skip, the method further comprises:
detecting whether the plug-in page is changed in real time;
when the plug-in page is detected to be changed, the routing information of the changed plug-in is sent to the query parameters of the browser to be stored.
7. The plug-in virtual route implementation method according to claim 1, wherein the current location information is a location object, the session history information is a history object, the Proxy is a Proxy object in JavaScript, and the Proxy object is configured to intercept route information sent when the browser accesses the plug-in and perform a custom operation on the location object and the history object of the Proxy.
8. A plug-in virtual route implementation apparatus, comprising:
The first initialization module is used for initializing the micro front end slot for connecting the browser with each plug-in unit and generating virtual routing information;
the second initialization module is used for acquiring initial route information of a current page of the browser and initializing virtual route information according to the initial route information;
the proxy module is used for proxy to the current position information and the conversation history information of each plug-in, obtaining the route information of the current page of each plug-in and storing the route information into the virtual route information;
the monitoring module is used for monitoring the route information of the browser in real time;
the updating module is used for receiving the current routing information and updating the routing information of the corresponding plugin in the virtual routing information when the current routing information of the browser is inconsistent with the initial routing information, so as to obtain routing change information, wherein the routing change information comprises plugin name data and page change events;
the page jump module is used for sending the route change information to a target plugin corresponding to the plugin name data, so that the target plugin obtains the updated virtual route information when receiving the page change event, and carries out page jump according to the virtual route information; and
And the information storage module is used for storing the updated route information of the target plug-in into the query parameters of the browser after the target plug-in finishes the page skip so as to display the updated route address of the plug-in.
9. A computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the plug-in virtual route implementation method according to any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the plug-in virtual routing implementation method according to any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310400538.0A CN116149757B (en) | 2023-04-14 | 2023-04-14 | Plug-in virtual route realization method, device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310400538.0A CN116149757B (en) | 2023-04-14 | 2023-04-14 | Plug-in virtual route realization method, device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116149757A CN116149757A (en) | 2023-05-23 |
CN116149757B true CN116149757B (en) | 2023-06-30 |
Family
ID=86341075
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310400538.0A Active CN116149757B (en) | 2023-04-14 | 2023-04-14 | Plug-in virtual route realization method, device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116149757B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110515683A (en) * | 2019-07-15 | 2019-11-29 | 平安普惠企业管理有限公司 | A kind of method, apparatus and storage medium of front end Vue page visual configuration |
WO2022033055A1 (en) * | 2020-08-12 | 2022-02-17 | 深圳前海微众银行股份有限公司 | Page rendering method, apparatus, and device, and computer readable storage medium |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106815276B (en) * | 2015-11-27 | 2020-06-16 | 阿里巴巴集团控股有限公司 | Page skipping method and device |
US10938923B2 (en) * | 2019-04-17 | 2021-03-02 | Home Depot Product Authority, Llc | Customizable router for managing traffic between application programming interfaces |
CN110221872B (en) * | 2019-04-22 | 2022-09-09 | 五八有限公司 | Page jump method and device, electronic equipment and storage medium |
-
2023
- 2023-04-14 CN CN202310400538.0A patent/CN116149757B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110515683A (en) * | 2019-07-15 | 2019-11-29 | 平安普惠企业管理有限公司 | A kind of method, apparatus and storage medium of front end Vue page visual configuration |
WO2022033055A1 (en) * | 2020-08-12 | 2022-02-17 | 深圳前海微众银行股份有限公司 | Page rendering method, apparatus, and device, and computer readable storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN116149757A (en) | 2023-05-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP2603865B1 (en) | Exposing resource capabilities to web applications | |
EP3270300A1 (en) | Method and device for form verification | |
CN111414407A (en) | Data query method and device of database, computer equipment and storage medium | |
CN108829477B (en) | Interface jump method, device, computer equipment and storage medium | |
CN111427803B (en) | Automated random test method, apparatus, computer device and medium | |
CN109857506B (en) | Method and device for realizing guide information, electronic equipment and storage medium | |
KR101674934B1 (en) | Apparatus and method of reporting exception | |
CN108762956B (en) | Method for acquiring Native local data, server, mobile terminal and storage medium | |
US8046757B2 (en) | Method for installing ActiveX control | |
CN110069308B (en) | Page starting method and device, electronic equipment and storage medium | |
JP5004857B2 (en) | Application update information providing system and application update information providing method | |
CN111651318A (en) | Prometheus-based interface monitoring method and device, computer equipment and storage medium | |
CN113761412A (en) | Application page display method and device, electronic equipment, medium and application system | |
CN112818270A (en) | Data cross-domain transfer method and device and computer equipment | |
CN114385124A (en) | Independent page jumping method, device and equipment based on Vue framework | |
CN116149757B (en) | Plug-in virtual route realization method, device, computer equipment and storage medium | |
CN107450946B (en) | Chrome webpage and terminal software communication method, equipment and storage medium | |
KR20020009741A (en) | Apparatus for etalishing operating platform of mobile phone and wireless up-grading method of application thereby | |
CN112491940B (en) | Request forwarding method and device of proxy server, storage medium and electronic equipment | |
CN112416698B (en) | Expansion method and device of monitoring system, storage medium and electronic equipment | |
US11861214B2 (en) | Memory device forensics and preparation | |
CN115098213A (en) | Data processing method and device, electronic equipment and storage medium | |
CN112181930B (en) | File management method and device for virtual switching matrix | |
CN114185804A (en) | Interface testing method and device and terminal equipment | |
CN113656063A (en) | System version replacing method, device, equipment and computer readable medium |
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 |