Micro front-end service application method, device, storage medium and electronic device

By setting up business modules with different service contents in the sub-application layer unit and configuring the center registry in the main application layer unit, the technical compatibility problems caused by a single framework are solved, and the support of multiple technology stacks and project scalability are achieved. , simplifies the maintenance process.

CN114679491BActive Publication Date: 2024-11-22JINGDONG TECH HLDG CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011573414.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-24
Publication Date
2024-11-22
Estimated Expiration
2040-12-24

Smart Images

  • Figure CN114679491B_ABST
    Figure CN114679491B_ABST
Patent Text Reader

Abstract

The present application provides a micro-front-end service application method, device, storage medium and electronic device. The micro-front-end service device provided in the embodiment of the present application sets a business module carrying different service contents in the sub-application layer unit and configures a central registry in the main application layer unit, so that the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application layer unit, so as to achieve compatibility of the business modules developed based on different frameworks in the sub-application layer unit in the main application layer unit, so that the micro-front-end service device can decouple the front-end business, and can also adaptively deploy specific business needs by configuring the business modules in the sub-application layer unit, thereby improving the scalability of the developed project.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a micro-front-end service application method, device, storage medium and electronic device. Background Art

[0002] In recent years, with the rapid development of related technologies in the front-end field, the engineering degree of the front-end has increased rapidly. However, as the project content increases, the volume of front-end engineering has also increased, and the maintenance problems it brings have become increasingly prominent. Among them, the front-end here is the layer facing Web users, which usually includes routing control, data aggregation, template rendering, content distribution and other aspects.

[0003] As the business of an enterprise develops and time goes by, there will be more and more common parts in various projects, making it increasingly difficult to maintain the front-end layer developed by independent project teams. Currently, Web front-end and back-end separation technology usually uses a single framework, for example, using Model View View Model (MVVM) to abstract the state and behavior of the view, allowing us to separate the view from the business logic.

[0004] However, adopting the above-mentioned single framework approach will result in projects developed based on the same framework only supporting that specific framework and not other frameworks, which will affect the scalability of the project. Summary of the invention

[0005] The embodiments of the present application provide a micro-front-end service application method, device, storage medium and electronic device to solve the technical problem that the current single framework approach cannot achieve technical compatibility with multiple front-end frameworks.

[0006] In a first aspect, an embodiment of the present application provides a micro-frontend service device, including: a main application layer unit and a sub-application layer unit;

[0007] At least one service module is provided in the sub-application layer unit, and the service module is used to carry the service content of the corresponding service;

[0008] The main application layer unit is configured with a central registry, and the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry to load the data file of the target business module into the main application unit.

[0009] In one possible design, a sub-application management module is provided in the main application layer unit;

[0010] The sub-application management module is used to match the access instruction to the target business module using the central registry, and load the static file of the target business module, and the data file includes the static file.

[0011] In a possible design, the micro-frontend service device further includes: a user access layer unit;

[0012] The user access layer unit is used to receive the access instruction and to display the page after the main application layer unit loads the static file.

[0013] In a possible design, at least one public service module is provided in the main application layer unit, and the public service module is used to provide public capabilities for the business modules, and the public capabilities are used to support corresponding user interaction operations.

[0014] In one possible design, the public service module includes at least one of an account management module, a permission management module, and a menu management module.

[0015] In a possible design, the micro-frontend service device further includes: a basic service layer unit;

[0016] Among them, the basic service layer unit is configured with a basic service module, and the basic service module is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation and management of the business module.

[0017] In one possible design, the micro-frontend service device further includes: a backend connection interface;

[0018] The backend connection interface is used to request the data file from the backend server corresponding to each business module.

[0019] In a second aspect, an embodiment of the present application provides a micro-front-end service application method, which is applied to a micro-front-end service device, wherein the micro-front-end service device includes: a main application layer unit and a sub-application layer unit, wherein the sub-application layer unit is provided with at least one business module, and the business module is used to carry the service content of the corresponding business; the method includes:

[0020] After the main application layer unit obtains the access instruction, the access instruction is forwarded to the corresponding target service module in the sub-application layer unit by using the central registration table in the main application layer unit;

[0021] Load the data file of the target business module into the main application unit.

[0022] In a possible design, the using a central registration table in the main application layer unit to forward the access instruction to a corresponding target service module in the sub-application layer unit includes:

[0023] The access instruction is matched to the target business module through the sub-application management module in the main application layer unit and by using the central registry, so as to load the static file of the target business module.

[0024] In a possible design, after the data file of the target business module is loaded into the main application, the method further includes:

[0025] The page after the main application loads the static file is displayed in the user access layer unit.

[0026] In a possible design, the micro-frontend service application method further includes:

[0027] In response to a user interaction operation, a target public service module is called in the main application layer unit, wherein the target public service module is a public service module in the main application layer unit corresponding to the user interaction operation, and the public service module is used to provide public capabilities for the business module, and the public capabilities are used to support the corresponding user interaction operations.

[0028] In one possible design, the public service module includes at least one of an account management module, a permission management module, and a menu management module.

[0029] In a possible design, the micro-frontend service application method further includes:

[0030] In response to a business management instruction, a target basic service module is called in the main application layer unit, wherein the basic service module is a basic service module in the main application layer unit corresponding to the business management instruction, and the basic service module is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation management of the business module.

[0031] In a possible design, the micro-frontend service application method further includes:

[0032] In response to the access instruction, the data file is requested from the backend server corresponding to each business module through the backend connection interface.

[0033] In a third aspect, an embodiment of the present application further provides an electronic device, including:

[0034] processor; and,

[0035] A memory, configured to store executable instructions of the processor;

[0036] The processor is configured to execute the functions of each unit in any one of the micro-front-end service devices in the first aspect by executing the executable instructions.

[0037] In a fourth aspect, an embodiment of the present application further provides a storage medium on which a computer program is stored, which, when executed by a processor, implements the functions of each unit in any one of the micro-front-end service devices in the first aspect.

[0038] In a fifth aspect, an embodiment of the present application further provides a computer program product, comprising a computer program, which, when executed by a processor, implements the functions of each unit in any one of the micro-front-end service devices in the first aspect.

[0039] A micro-front-end service application method, device, storage medium and electronic device provided in an embodiment of the present application, by setting a business module carrying different service contents in a sub-application layer unit and configuring a central registry in a main application layer unit, so that the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application unit, so that the main application unit can be compatible with the business modules developed based on different frameworks in the sub-application layer unit, so that the micro-front-end service device can decouple the front-end business, and can also adaptively deploy specific business needs by configuring the business modules in the sub-application layer unit, thereby improving the scalability of the developed project. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0041] Figure 1 is a schematic diagram of a micro-frontend service device according to an exemplary embodiment of the present application;

[0042] Figure 2 It is a flowchart of a micro-frontend service application method according to an exemplary embodiment of the present application;

[0043] Figure 3 is a flowchart of a micro-frontend service application method according to another exemplary embodiment of the present application;

[0044] Figure 4 It is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present application. DETAILED DESCRIPTION

[0045] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0046] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0047] As the business of an enterprise develops and time goes by, the common parts of each project will become more and more, making the front-end layer developed by an independent project team more and more difficult to maintain. Generally speaking, a large business system (for example, a financial business system, an educational business system, and an entertainment business system, etc.) will contain multiple business modules, each of which is supported by a corresponding back-end service. In the normal development process, each back-end service corresponds to an independent front-end. At the same time, due to technical selection, decision-making, historical legacy and other reasons, the technology stacks used by each front-end may be different, and the devices may be different. If the consistency of the device needs to be maintained, the Web front-end and back-end separation technology is used to implement it. Usually a single framework is used. For example, the MVVM device is used to abstract the state and behavior of the view, so that we can separate the view and business logic. However, the use of a single framework will cause the project developed based on the same framework to have a high dependence on a specific front-end framework. When other front-end frameworks are needed in the platform, the technical compatibility cannot be well guaranteed.

[0048] In response to the above technical problems, the technical concept of the present application is to set up business modules that carry different service contents in the sub-application layer unit, and configure a central registry in the main application layer unit, so that the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application unit, so that the main application unit can be compatible with the business modules developed based on different frameworks in the sub-application layer unit, so that the micro-front-end service device can decouple the front-end business, and can also adaptively deploy specific business needs by configuring the business modules in the sub-application layer unit.

[0049] Figure 1 1 is a schematic diagram of a micro-frontend service device according to an exemplary embodiment of the present application. Figure 1 As shown, the micro-frontend service device provided in the present application includes: a main application layer unit and a sub-application layer unit.

[0050] Among them, at least one business module is set in the sub-application layer unit, and the business module is used to carry the service content of the corresponding business. For example, in a financial business system, the sub-application layer unit can be provided with business modules such as "fund", "post-investment", "map", "strategy", "investment research" and "external project", and each business module is used to carry the corresponding financial business content and functions. "Fund" can be used as one of the business modules for example, and the business module can be used to display content and services related to fund business.

[0051] In addition, a central registry is configured in the main application layer unit, and the access instruction can be forwarded to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry in the main application layer unit, so as to load the data file of the target business module into the main application. It is worth noting that in a possible design, the communication between the main application layer unit and the sub-application layer unit can be implemented by eventemitter3.

[0052] The above-mentioned central registry can be used to establish an address access relationship between the main application layer unit and the sub-application layer unit. When the main application layer unit receives a related access instruction, it can be forwarded to the corresponding business module in the sub-application layer unit through the mapping relationship in the central registry. For example, if the access instruction obtained in the main application layer unit is used to access the relevant business or service of "fund", the access instruction can be forwarded to the "fund" module in the sub-application layer unit through the central registry, so that the data file in the "fund" module is loaded into the main application for display in the main application.

[0053] Optionally, the data file of the target business module can be loaded into the main application through import-html-entry. Specifically, it can be implemented by reading the js\css and other entries in the HTML of the target business module and then injecting them into the HTML of the main application.

[0054] Among them, the above-mentioned central registry can be implemented through the method in the Single-SPA framework. Therefore, it can be compatible with various technology stacks, that is, multiple technologies (for example: React, Vue, AngularJS, Angular, Ember) can be used in the same page, and there is no need to reload the page. In addition, there is no need to refactor the existing code, that is, if you want to use a new technical framework to write code, the code in the existing project does not need to be refactored. In addition, the code of each independent module can be loaded on demand without wasting extra resources. In addition, each independent module is independently developed and run independently, and the optimal access rights can be configured, and the functions can be split to the minimum, and the permissions can be divided according to the functions. Thus, multiple projects with different technologies are integrated together through Single-SPA and the central registry therein.

[0055] In this embodiment, by setting up business modules that carry different service contents in the sub-application layer unit and configuring a central registry in the main application layer unit, the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application, so that the main application can be compatible with the business modules developed based on different frameworks in the sub-application layer unit, so that the micro-front-end service device can decouple the front-end business, and can also adaptively deploy specific business needs by configuring the business modules in the sub-application layer unit.

[0056] Continue to refer to Figure 1 On the basis of the above embodiment, a sub-application management module may also be provided in the main application layer unit, wherein the sub-application management module is used to match the access instruction to the target business module using the central registry, and load the static files of the target business module, and the above-mentioned data files include static files. It is worth noting that the types of business modules in the sub-application layer unit can be constructed according to actual needs. If a new business module needs to be added to the sub-application layer unit, it can be implemented by registering the business module in the sub-application management module. Among them, for the loading of static files, the Systemjs tool can be used, which is a general Javascript module loader that can load ES6 modules AMD CommonJS and global scripts in browsers and NodeJS.

[0057] In addition, at least one public service module may be provided in the main application layer unit, and the public service module is used to provide public capabilities for the business module, and the public capabilities are used to support corresponding user interaction operations. Figure 1 As shown, the public service module may include at least one of an account management module, a permission management module, and a menu management module. It is worth noting that some commonly used functional modules in various applications can be selected as public service modules. For example, in various applications, account management is usually required. Therefore, the account management module can be set in the main application unit to make it a public service module of the entire device, so as to avoid setting the functional module separately and repeatedly in various business modules, thereby effectively simplifying the system.

[0058] Based on the above embodiment, the micro front-end service device may further include: a basic service layer unit. The basic service layer unit is configured with a basic service module, which is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation and management of the business module. Figure 1 The basic service module may include at least one of a monitoring module, a distribution module, a tracking module and a simulation module. It is worth noting that the basic service module is used to provide basic capabilities in operation management for the business module, that is, it can monitor the operation of the business module, distribute business, manage tracking points, simulate data and other operations.

[0059] Continue to refer to Figure 1 The micro-frontend service device provided in this embodiment may also include: a backend connection interface, for which JEN nginx may be used. The backend connection interface is used to request data files from the backend servers corresponding to each business module. For example, in response to an access instruction to the "fund" business module, a response data file is requested from the fund backend server for front-end display, for example, display in the form of a browser or a WeChat applet page.

[0060] Figure 2 FIG. 1 is a flow chart of a micro-frontend service application method according to an exemplary embodiment of the present application. Figure 2 As shown, the micro-frontend service application method provided in this embodiment includes:

[0061] Step 101: Obtain an access instruction in the main application layer unit.

[0062] The micro-frontend service application method provided in this embodiment is applied to the micro-frontend service device provided in any of the above embodiments. The frontend service device includes: a main application layer unit and a sub-application layer unit.

[0063] Among them, at least one business module is set in the sub-application layer unit, and the business module is used to carry the service content of the corresponding business. For example, in a financial business system, the sub-application layer unit can be provided with business modules such as "fund", "post-investment", "map", "strategy", "investment research" and "external project", and each business module is used to carry the corresponding financial business content and functions. "Fund" can be used as one of the business modules for example, and the business module can be used to display content and services related to fund business.

[0064] When a user needs to access a related target service module, the user can input a corresponding access instruction in the user access layer unit, so that the main application layer unit obtains the access instruction.

[0065] Step 102: Use the central registration table in the main application layer unit to forward the access instruction to the corresponding target service module in the sub-application layer unit.

[0066] A central registry is configured in the main application layer unit, and the access instruction can be forwarded to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry in the main application layer unit, so as to load the data file of the target business module into the main application unit. It is worth noting that in a possible design, the communication between the main application layer unit and the sub-application layer unit can be implemented by eventemitter3.

[0067] Step 103: Load the data file of the target business module into the main application.

[0068] The above-mentioned central registry can be used to establish an address access relationship between the main application layer unit and the sub-application layer unit. When the main application layer unit receives a related access instruction, it can be forwarded to the corresponding business module in the sub-application layer unit through the mapping relationship in the central registry. For example, if the access instruction obtained in the main application layer unit is used to access the relevant business or service of "fund", the access instruction can be forwarded to the "fund" module in the sub-application layer unit through the central registry, so that the data file in the "fund" module is loaded into the main application for display in the main application.

[0069] Optionally, the data file of the target business module can be loaded into the main application through import-html-entry. Specifically, it can be implemented by reading the js\css and other entries in the HTML of the target business module and then injecting them into the HTML of the main application.

[0070] Among them, the above-mentioned central registry can be implemented through the method in the Single-SPA framework. Therefore, it can be compatible with various technology stacks, that is, multiple technologies (for example: React, Vue, AngularJS, Angular, Ember) can be used in the same page, and there is no need to reload the page. In addition, there is no need to refactor the existing code, that is, if you want to use a new technical framework to write code, the code in the existing project does not need to be refactored. In addition, the code of each independent module can be loaded on demand without wasting extra resources. In addition, each independent module is independently developed and run independently, and the optimal access rights can be configured, and the functions can be split to the minimum, and the permissions can be divided according to the functions. Thus, multiple projects with different technologies are integrated together through Single-SPA and the central registry therein.

[0071] In this embodiment, by setting up business modules that carry different service contents in the sub-application layer unit and configuring a central registry in the main application layer unit, the main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application unit, so that the main application unit can be compatible with the business modules developed based on different frameworks in the sub-application layer unit, so that the micro-front-end service device can decouple the front-end business, and can also adaptively deploy specific business needs by configuring the business modules in the sub-application layer unit, thereby improving the scalability of the developed project.

[0072] Figure 3 FIG. 1 is a flow chart of a micro-frontend service application method according to another exemplary embodiment of the present application. Figure 3 As shown, the micro-frontend service application method provided in this embodiment includes:

[0073] Step 201: The access instruction is obtained in the main application layer unit.

[0074] The micro-frontend service application method provided in this embodiment is applied to the micro-frontend service device provided in any of the above embodiments. The frontend service device includes: a main application layer unit and a sub-application layer unit.

[0075] Among them, at least one business module is set in the sub-application layer unit, and the business module is used to carry the service content of the corresponding business. For example, in a financial business system, the sub-application layer unit can be provided with business modules such as "fund", "post-investment", "map", "strategy", "investment research" and "external project", and each business module is used to carry the corresponding financial business content and functions. "Fund" can be used as one of the business modules for example, and the business module can be used to display content and services related to fund business.

[0076] When a user needs to access a related target service module, the user can input a corresponding access instruction in the user access layer unit, so that the main application layer unit obtains the access instruction.

[0077] Step 202: Match the access instruction to the target business module through the sub-application management module in the main application layer unit and using the central registry to load the static file of the target business module.

[0078] On the basis of the above embodiment, a sub-application management module may also be provided in the main application layer unit, wherein the sub-application management module is used to match the access instruction to the target business module using the central registry, and load the static files of the target business module, and the above-mentioned data files include static files. It is worth noting that the types of business modules in the sub-application layer unit can be constructed according to actual needs. If a new business module needs to be added to the sub-application layer unit, it can be implemented by registering the business module in the sub-application management module. Among them, for the loading of static files, the Systemjs tool can be used, which is a general Javascript module loader that can load ES6 modules AMD CommonJS and global scripts in browsers and NodeJS.

[0079] Step 203: Load the data file of the target business module into the main application.

[0080] The above-mentioned central registry can be used to establish an address access relationship between the main application layer unit and the sub-application layer unit. When the main application layer unit receives a related access instruction, it can be forwarded to the corresponding business module in the sub-application layer unit through the mapping relationship in the central registry. For example, if the access instruction obtained in the main application layer unit is used to access the relevant business or service of "fund", the access instruction can be forwarded to the "fund" module in the sub-application layer unit through the central registry, so that the data file in the "fund" module is loaded into the main application for display in the main application.

[0081] Optionally, the data file of the target business module can be loaded into the main application through import-html-entry. Specifically, it can be implemented by reading the js\css and other entries in the HTML of the target business module and then injecting them into the HTML of the main application.

[0082] Among them, the above-mentioned central registry can be implemented through the method in the Single-SPA framework. Therefore, it can be compatible with various technology stacks, that is, multiple technologies (for example: React, Vue, AngularJS, Angular, Ember) can be used in the same page, and there is no need to reload the page. In addition, there is no need to refactor the existing code, that is, if you want to use a new technical framework to write code, the code in the existing project does not need to be refactored. In addition, the code of each independent module can be loaded on demand without wasting extra resources. In addition, each independent module is independently developed and run independently, and the optimal access rights can be configured, and the functions can be split to the minimum, and the permissions can be divided according to the functions. Thus, multiple projects with different technologies are integrated together through Single-SPA and the central registry therein.

[0083] Step 204: Display the page after the main application loads the static file in the user access layer unit.

[0084] In this step, data files may be requested from the backend servers corresponding to each business module through the backend connection interface. For example, in response to the access instruction to the "fund" business module, a static file is requested from the fund backend server, and the static file is loaded into the main application layer unit, so that the page after the main application layer unit loads the static file is displayed in the user access layer unit, for example, in the form of a browser or a WeChat applet page.

[0085] In addition, at least one public service module may be provided in the main application layer unit, and the public service module is used to provide public capabilities for the business module, and the public capabilities are used to support corresponding user interaction operations. Figure 1 As shown, the public service module may include at least one of: an account management module, a permission management module, and a menu management module. It is worth noting that some commonly used functional modules in various applications can be selected as public service modules. For example, in various applications, account management is usually required. Therefore, the account management module can be set in the main application to make it a public service module for the entire device, so as to avoid setting the functional module separately and repeatedly in each business module, thereby effectively simplifying the system. In response to user interaction operations, the target public service module can be called in the main application layer unit, wherein the target public service module is a public service module in the main application layer unit corresponding to the user interaction operation, and the public service module is used to provide public capabilities for the business module, and the public capabilities are used to support corresponding user interaction operations.

[0086] In addition, the micro-frontend service device may further include: a basic service layer unit. The basic service layer unit is configured with a basic service module, which is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation and management of the business module. Figure 1 , the above-mentioned basic service module may include: at least one of a monitoring module, a distribution module, a tracking module and a simulation module. It is worth noting that the basic service module is used to provide basic capabilities in operation management for the business module, that is, it can monitor the operation of the business module, distribute business, manage tracking points, simulate data and other operations. In response to the business management instruction, the target basic service module can be called in the main application layer unit, wherein the basic service module is the basic service module in the main application layer unit corresponding to the business management instruction.

[0087] Figure 4 is a schematic diagram of the structure of an electronic device according to an exemplary embodiment of the present application. Figure 4 As shown, this embodiment provides an electronic device 300, including:

[0088] processor 301; and,

[0089] A memory 302, used to store executable instructions of the processor, and the memory may also be a flash memory;

[0090] The processor 301 is configured to execute the steps in the above method by executing the executable instructions. For details, please refer to the relevant description of the functions of each unit in the micro-frontend service device.

[0091] Optionally, the memory 302 may be independent or integrated with the processor 301 .

[0092] When the memory 302 is a device independent of the processor 301, the electronic device 300 may further include:

[0093] The bus 303 is used to connect the processor 301 and the memory 302 .

[0094] This embodiment also provides a readable storage medium, in which a computer program is stored. When at least one processor of an electronic device executes the computer program, the electronic device executes the functions of each unit in the micro-front-end service device provided by the various embodiments described above.

[0095] This embodiment also provides a program product, which includes a computer program, which is stored in a readable storage medium. At least one processor of the electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device implements the functions of each unit in the micro-frontend service device provided by the various embodiments described above.

[0096] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0097] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A micro front-end service device, characterized in that: include: Main application layer unit and sub-application layer unit; At least one service module is provided in the sub-application layer unit, and the service module is used to carry the service content of the corresponding service; The main application layer unit is configured with a central registry, which is implemented by the Single-SPA framework. The main application layer unit forwards the access instruction to the target business module corresponding to the access instruction in the sub-application layer unit through the central registry, so as to load the data file of the target business module into the main application layer unit. The central registry is used to establish an address access relationship between the main application layer unit and the sub-application layer unit. The central registry includes a mapping relationship between the access instruction and the business module. The main application layer unit and the sub-application layer unit communicate in the eventemitter3 mode; The main application layer unit is provided with a sub-application management module; The sub-application management module is used to match the access instruction to the target business module using the central registry, and load the static file of the target business module, and the data file includes the static file; At least one public service module is provided in the main application layer unit, and the public service module is used to provide public capabilities for the business modules, and the public capabilities are used to support corresponding user interaction operations.

2. The micro-frontend service device according to claim 1, characterized in that: Also includes: User access layer unit; The user access layer unit is used to receive the access instruction and to display the page after the main application layer unit loads the static file.

3. The micro-frontend service device according to claim 1, characterized in that: The public service module includes at least one of an account management module, a rights management module and a menu management module.

4. The micro-frontend service device according to claim 1 or 2, characterized in that: Also includes: Basic service layer unit; Among them, the basic service layer unit is configured with a basic service module, and the basic service module is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation and management of the business module.

5. The micro-frontend service device according to claim 1 or 2, characterized in that: Also includes: Backend connection interface; The backend connection interface is used to request the data file from the backend server corresponding to each business module.

6. A micro-frontend service application method, characterized in that: Applied to a micro-front-end service device, the micro-front-end service device includes: a main application layer unit and a sub-application layer unit, the sub-application layer unit is provided with at least one business module, and the business module is used to carry the service content of the corresponding business; the method includes: After the main application layer unit obtains the access instruction, the access instruction is forwarded to the corresponding target business module in the sub-application layer unit by using the central registry in the main application layer unit, the central registry is used to establish an address access relationship between the main application layer unit and the sub-application layer unit, the central registry includes a mapping relationship between the access instruction and the business module, the central registry is implemented by the Single-SPA framework, and the main application layer unit and the sub-application layer unit communicate in the eventemitter3 mode; Loading the data file of the target service module into the main application layer unit; The method of forwarding the access instruction to the corresponding target service module in the sub-application layer unit by using the central registration table in the main application layer unit includes: Matching the access instruction to the target business module through the sub-application management module in the main application layer unit and using the central registry to load the static file of the target business module; Also includes: In response to a user interaction operation, a target public service module is called in the main application layer unit, wherein the target public service module is a public service module in the main application layer unit corresponding to the user interaction operation, and the public service module is used to provide public capabilities for the business module, and the public capabilities are used to support the corresponding user interaction operations.

7. The micro-frontend service application method according to claim 6, characterized in that: After the data file of the target service module is loaded into the main application layer unit, the method further includes: The page after the main application layer unit loads the static file is displayed in the user access layer unit.

8. The micro-frontend service application method according to claim 6, characterized in that: The public service module includes at least one of an account management module, a rights management module and a menu management module.

9. The micro-frontend service application method according to claim 6 or 7, characterized in that: Also includes: In response to a business management instruction, a basic service module is called in the main application layer unit, wherein the basic service module is a basic service module in the main application layer unit corresponding to the business management instruction, and the basic service module is used to provide basic capabilities for the business module, and the basic capabilities are used to support the operation management of the business module.

10. The micro-frontend service application method according to claim 6 or 7, characterized in that: Also includes: In response to the access instruction, the data file is requested from the backend server corresponding to each business module through the backend connection interface.

11. An electronic device, characterized in that: include: processor; as well as a memory for storing a computer program for the processor; Wherein, the processor is configured to implement the functions of each unit in the micro-front-end service device described in any one of claims 1 to 5 by executing the computer program.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the micro-frontend service application method according to any one of claims 6 to 10 is implemented.

13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the micro-frontend service application method described in any one of claims 6 to 10 is implemented.