Route loading method and device, equipment and storage medium

By automatically building and loading routing configuration tables in front-end development projects, the complex problem of routing configuration file maintenance is solved, efficient and accurate routing management and automatic loading are achieved, and development efficiency and system scalability are improved.

CN119987836APending Publication Date: 2025-05-13CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411877197.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-18
Publication Date
2025-05-13

AI Technical Summary

Technical Problem

In the prior art, as the scale of front-end development projects increases, the maintenance and management of routing configuration files becomes complicated and tedious. The configuration files are configured and maintained through manual modification, which increases the workload and is prone to errors.

Method used

Create a configuration file in the home directory of each module in the target project, obtain the internal module path and module information of each module to build a routing configuration table, and replace the internal module path with an external module path, automatically map the metadata in the configuration file to the routing object in the routing configuration table, and load it into the target project.

Benefits of technology

Through automated routing configuration, the routing management and maintenance process is simplified, development efficiency is improved, manual configuration errors are avoided, paths are correct parsed in different environments, and flexible, fast and automatic loading of routes is achieved, providing higher scalability and adaptability for the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119987836A_ABST
    Figure CN119987836A_ABST
Patent Text Reader

Abstract

The invention relates to the field of front-end development, in particular to a route loading method, device and equipment and a storage medium, and aims to realize automatic route configuration. The method comprises the steps that in a main directory of each module of a target project, a configuration file corresponding to the module is created, and the configuration file at least comprises metadata corresponding to the module; obtaining an internal module path and module information corresponding to each module to construct a routing configuration table; in the routing configuration table, replacing the internal module path with an external module path, so that a user accesses the module through the external module path; mapping the metadata in the configuration file to a routing object in the routing configuration table; and loading the routing object into the target item.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of front-end development, and specifically, to a routing loading method, apparatus, device and storage medium. Background Art

[0002] In the process of front-end development, for each front-end development project, it is necessary to configure the routing information of each project. In the prior art, the routing information of each project is generally written manually. In the prior art, as the project scale increases, the maintenance and management of routing configuration files becomes more and more complicated and cumbersome. Configuring and maintaining configuration files by manual modification greatly increases the workload, and the configuration efficiency is low and prone to errors. Summary of the invention

[0003] The embodiments of the present application provide a route loading method, apparatus, device and storage medium, aiming to realize automatic route configuration.

[0004] A first aspect of an embodiment of the present application provides a route loading method, the method comprising: In the main directory of each module of the target project, create a configuration file corresponding to the module, wherein the configuration file includes at least metadata corresponding to the module; Obtaining the internal module path and module information corresponding to each of the modules to construct a routing configuration table; In the routing configuration table, the internal module path is replaced with an external module path so that a user can access the module through the external module path; Mapping the metadata in the configuration file to a routing object in the routing configuration table; Load the routing object into the target project.

[0005] Optionally, the method further comprises: Get the directory name of each directory in the external module path; According to the directory name, determine the code file path corresponding to each module; The code file path is added to the routing configuration table, so that the background of the target project obtains the module code of each module according to the code file path.

[0006] Optionally, the method further comprises: When it is detected that a user logs in to the front-end page of the target project, obtaining a permission list corresponding to the user; Determine the permissions corresponding to the user according to the permission list; Determine the menu item and operation button corresponding to the user according to the authority corresponding to the user; According to the route of each module in the routing configuration table, the menu items and the operation buttons are loaded into the front-end page.

[0007] Optionally, the method further comprises: Monitor the permission configuration of the target project; When a change in the permission configuration corresponding to the user is detected, updating the permission list of the user; According to the updated permission list, the corresponding menu items and the operation buttons are loaded into the front-end page.

[0008] Optionally, acquiring the internal module path and module information corresponding to each module according to the configuration file to construct a routing configuration table includes: Scan the directory structure of the target project to determine the internal module path corresponding to the configuration file; Read the configuration file to obtain module information corresponding to the configuration file; Generate an array corresponding to the internal module path and the module information; The routing configuration table is constructed according to the array.

[0009] Optionally, loading the routing object into the target project includes: According to the routing configuration table, determine the route corresponding to each module; The routing and permission configuration corresponding to each module is stored in a project file of a preset format; The project file corresponding to each module is loaded into the target project.

[0010] Optionally, the method further comprises: According to the routing object in the target project, obtain navigation bar configuration information, the navigation bar configuration information at least including menu items, paths, and icons; Generate a corresponding navigation bar according to the navigation bar configuration information; Binding the external module path corresponding to each module to the jump address of the navigation bar; According to the authority configuration corresponding to each user, the corresponding menu items and function buttons are displayed in the navigation bar of the front-end page of the target project corresponding to each user.

[0011] A second aspect of an embodiment of the present application provides a route loading device, the device comprising: A configuration file creation module, used to create a configuration file corresponding to each module in the main directory of the target project, wherein the configuration file at least includes metadata corresponding to the module; A routing configuration table building module, used to obtain the internal module path and module information corresponding to each module to build a routing configuration table; A path replacement module, used to replace the internal module path with an external module path in the routing configuration table, so that a user can access the module through the external module path; A mapping module, used to map the metadata in the configuration file to a routing object in the routing configuration table; The routing loading module is used to load the routing object into the target project.

[0012] Optionally, the device further comprises: A directory name acquisition module, used to obtain the directory name of each directory in the external module path; A code file path acquisition module, used to determine the code file path corresponding to each module according to the directory name; The path adding module is used to add the code file path to the routing configuration table so that the background of the target project obtains the module code of each module according to the code file path.

[0013] Optionally, the device further comprises: The permission list acquisition module is used to acquire the permission list corresponding to the user when it is detected that the user logs in to the front-end page of the target project; A permission determination module, used to determine the permission corresponding to the user according to the permission list; A menu item determination module, used to determine the menu item and operation button corresponding to the user according to the authority corresponding to the user; The menu item loading module is used to load the menu items and the operation buttons into the front-end page according to the routes of each module in the routing configuration table.

[0014] Optionally, the device further comprises: A monitoring module, used to monitor the permission configuration of the target project; A list updating module, used to update the permission list of the user when a change in the permission configuration corresponding to the user is detected; The hot reload module is used to load the corresponding menu items and the operation buttons into the front-end page according to the updated permission list.

[0015] Optionally, the routing configuration table construction module includes: A path determination submodule, used to scan the directory structure of the target project and determine the internal module path corresponding to the configuration file; The module information determination submodule is used to read the configuration file and obtain the module information corresponding to the configuration file; An array generation submodule, used to generate an array corresponding to the internal module path and the module information; The routing configuration table generation submodule is used to construct the routing configuration table according to the array.

[0016] Optionally, the routing loading module includes: A route determination submodule, used to determine the route corresponding to each module according to the route configuration table; A data storage submodule, used for storing the routing and permission configuration corresponding to each module in a project file of a preset format; The project file loading submodule is used to load the project file corresponding to each module into the target project.

[0017] Optionally, the device further comprises: A navigation bar configuration information acquisition module, used to acquire navigation bar configuration information according to the routing object in the target project, wherein the navigation bar configuration information at least includes menu items, paths, and icons; A navigation bar generation module, used to generate a corresponding navigation bar according to the navigation bar configuration information; Binding the external module path corresponding to each module to the jump address of the navigation bar; The menu item display module is used to display corresponding menu items and function buttons in the navigation bar of the front-end page of the target project corresponding to each user according to the authority configuration corresponding to each user.

[0018] A third aspect of an embodiment of the present application provides a readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps in the method described in the first aspect of the present application are implemented.

[0019] A fourth aspect of an embodiment of the present application provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in the first aspect of the present application are implemented.

[0020] Using the routing loading method provided by the present application, a configuration file corresponding to each module of the target project is created in the main directory of the module, and the configuration file at least includes metadata corresponding to the module; the internal module path and module information corresponding to each module are obtained to build a routing configuration table; in the routing configuration table, the internal module path is replaced with an external module path so that the user can access the module through the external module path; the metadata in the configuration file is mapped to the routing object in the routing configuration table; and the routing object is loaded into the target project.

[0021] In this method, a configuration file containing metadata of each module is first created, and the internal module path and module information corresponding to each module are obtained, and then a routing configuration table is constructed, and then the path of the routing configuration table is replaced, and the metadata in the configuration file is mapped to the routing object in the routing configuration table, and then the routing object is loaded into the target project. Through the above-mentioned automated routing generation mechanism, the routing configuration is automatically generated and loaded according to the project directory, which improves the development efficiency. Through path replacement, it is ensured that the actual path of the module can be parsed in different environments, avoiding the unavailability of functions caused by path errors, and realizing that the routing corresponding to each module can be flexibly and quickly automatically loaded in the target project, providing the system with higher scalability and adaptability. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only 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.

[0023] Figure 1 is a flow chart of a route loading method proposed in an embodiment of the present application; Figure 2 This is a schematic diagram of the route loading process proposed in an embodiment of the present application; Figure 3 is a schematic diagram of a route loading device proposed in an embodiment of the present application; Figure 4 It is a schematic diagram of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0024] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions 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.

[0025] refer to Figure 1 , Figure 1 Flowchart of the route loading method proposed in one embodiment of the present application. Figure 1 As shown, the method comprises the following steps: S11: In the main directory of each module of the target project, create a configuration file corresponding to the module.

[0026] In this embodiment, the target project is a front-end project under development. Each module in the target project is a specific functional module in the front-end project. The configuration file corresponding to each module is a file containing the metadata information of the module, which is used to uniformly manage the relevant data of each module so that the system can easily configure the routing. The directory structure refers to the hierarchical organization of files and folders in the file system. Usually, the directory structure of the project is divided according to functions or modules to facilitate the management and maintenance of the code. In front-end development, the directory structure can be used to automatically generate routing and navigation configurations, for example, by scanning the project directory structure and identifying specific file paths, thereby dynamically generating routing and navigation bar configurations.

[0027] In this embodiment, during the project development process, a configuration file corresponding to each module is created in the main directory of each module according to pre-defined rules.

[0028] By way of example, the configuration file is named page.js.

[0029] S12: Obtain the internal module path and module information corresponding to each module to construct a routing configuration table.

[0030] In this embodiment, the internal module path is the path of the directory where each module is located during project development, the module information is the data information related to the module, and the routing configuration table is a list of the module path and module information of each module in the target project.

[0031] In this embodiment, the directory structure in the project is scanned to obtain the internal module path and module information corresponding to each module, and then construct a routing configuration table.

[0032] In this embodiment, the specific steps of obtaining the internal module path and module information corresponding to each module to construct the routing configuration table include: S12-1: Scan the directory structure of the target project to determine the internal module path corresponding to the configuration file.

[0033] In this embodiment, the directory structure of the target project is scanned to determine the internal module path of the configuration file corresponding to each module.

[0034] S12-2: Read the configuration file, and obtain module information corresponding to the configuration file.

[0035] In this embodiment, the configuration file is read to obtain module information corresponding to the configuration file. The module information includes information such as metadata (eg, title, permission list) corresponding to each module.

[0036] S12-3: Generate the internal module path and the array corresponding to the module information.

[0037] In this embodiment, after obtaining the internal module path and module information, the internal module path and module information of each module are used to form a corresponding array.

[0038] S12-4: Construct the routing configuration table according to the array.

[0039] In this embodiment, after the corresponding array is obtained, the internal module path and module information of each module included in the array are added to the same list to obtain a routing configuration table.

[0040] In this example, during the pre-compilation phase of the project using Vite (project development tool), the system batch imports all previously written page.js files through the import.meta.glob method (a special feature provided by Vite that allows multiple modules to be dynamically imported within the module scope. This is particularly useful when dealing with a large number of files, especially when you need to dynamically load them based on certain conditions or patterns. This method can scan the directory structure of the project and automatically generate an array of module paths and module information. Through this batch import method, the system does not need to manually configure the path of each module, which greatly improves development efficiency.

[0041] S13: In the routing configuration table, the internal module path is replaced with an external module path, so that the user can access the module through the external module path.

[0042] In this embodiment, the external module path is the path used by the user when accessing the front-end page corresponding to the target project.

[0043] In this embodiment, in order to define the address used by external users when accessing each module, the internal module path is replaced with the external module path in the routing configuration table so that the user can access the module through the external module path.

[0044] In this embodiment, the data returned by import.meta.glob is used as a preliminary routing configuration table, and the path of page.js in the project is replaced through the replace method (a method provided by the string object, used to find and replace the specified substring in the string. Its basic syntax is: str.replace(old, new[, count]), where old is the substring to be replaced, new is the new substring after replacement, and count is an optional parameter indicating the number of replacements. The default is to replace all. The replace method returns a new string in which all occurrences of the old substring are replaced with the new substring. If the count parameter is specified, only the first count occurrences of the old substring are replaced.)

[0045] S14: Map the metadata in the configuration file to the routing object in the routing configuration table.

[0046] In this embodiment, the route object represents the status information of the currently activated route, including the information obtained by parsing the current URL and the route record matched by the URL. The route object is immutable, and each successful navigation will generate a new object.

[0047] In this embodiment, each module in the target project has a routing object in the routing configuration table. Specifically, the system maps the metadata (such as title, authority, etc.) in page.js directly to the meta attribute of the generated routing object (the meta attribute is a tag in HTML used to provide metadata, usually located inside the tag. The meta attribute itself is not displayed on the page, but is used to provide information about the web page to browsers and search engines).

[0048] S15: Load the routing object into the target project.

[0049] In this embodiment, all the routing objects in the routing configuration table are loaded into the target project, thereby achieving the purpose of loading the routing corresponding to each module into the target project.

[0050] In this embodiment, Vite's createRouter method (the main function of the createRouter method is to initialize the routing configuration and create routing objects. It integrates the entire process of routing initialization, including defining core routing methods and other responsibilities. Through createRouter, developers can define routing rules, set routing guards, manage routing status, etc., so as to build a fully functional single-page application) batch load these routing objects, thereby realizing the dynamic loading function of routing. This technical solution can automatically generate and update routing configuration according to the information of the module, without manual maintenance, ensuring the flexibility and scalability of the project.

[0051] In this embodiment, the step of loading the routing object into the target project includes: S15-1: Determine the route corresponding to each module according to the routing configuration table.

[0052] In this embodiment, the route corresponding to each module is determined according to the path information of each module in the routing configuration table.

[0053] S15-2: Storing the routing and permission configuration corresponding to each module in a project file in a preset format.

[0054] In this embodiment, the routing and permission configuration corresponding to each module are stored in a project file in a preset format.

[0055] S15-3: Load the project file corresponding to each module into the target project.

[0056] In this embodiment, the project file corresponding to each module is loaded into the target project.

[0057] In this embodiment, the JSON format (JavaScript Object Notation is a lightweight data exchange format designed based on a subset of ECMAScript and is independent of the programming language. JSON is easy for humans to read and write, and is also easy for machines to parse and generate. It is widely used in data storage and network transmission) is used to store routing and permission configurations, split the configuration into multiple small files, support on-demand loading, and use the dynamic import() function to load other configuration files. The loaded JSON configuration is converted into the format required by the application, and a deep merging algorithm is designed to support incremental updates. The algorithm supports merging of multi-layer nested configuration objects to ensure that the new configuration can correctly overwrite or extend the existing configuration. The core ideas of the algorithm include recursive strategies, hierarchical structure preservation, object-to-object merging, and basic type overwriting. Configuration hot reloading monitors configuration changes through WebSocket or long polling technology, and dynamically reloads and applies the new configuration when an update notification is received.

[0058] In this embodiment, the method further includes: S16: Obtain the directory name of each directory in the external module path.

[0059] In this embodiment, each directory has a directory name, and the directory name of each directory in the external module path is obtained.

[0060] S17: Determine the code file path corresponding to each module according to the directory name.

[0061] In this embodiment, the code file path is the path where the execution code corresponding to each module is located.

[0062] In this embodiment, according to the directory name of each directory, the code file path corresponding to each module is searched in the project file of the target project.

[0063] S18: Add the code file path to the routing configuration table, so that the background of the target project obtains the module code of each module according to the code file path.

[0064] In this embodiment, the code file path is added to the routing configuration table so that the background of the target project can obtain the module code of each module according to the code file path. When the user logs in, the corresponding module code can be quickly located according to the external module path entered by the user, and then the corresponding module can be displayed.

[0065] In this example, the split method is used (the split method is an instance method of the String class in Java, which is used to split a string into substrings according to a given delimiter and return the result as a string list.) to process the generated route name. The index.vue file (code file) of each module is further located through the import.meta.glob method to ensure that in the production environment, even if the project directory structure changes, the system can still obtain the correct path, thereby ensuring the stability and correctness of the route.

[0066] In this embodiment, in the traditional development mode, whenever a module is added or modified, the developer needs to manually update the routing configuration file. This method is not only prone to errors, but also increases the maintenance cost of the project. Through the above-mentioned automated routing generation mechanism, the system can automatically generate and load routing configurations according to the project directory, avoiding the cumbersome steps of manual configuration and improving development efficiency. Since the project directory in the production environment may be different from the development environment, the manually configured path is prone to failure during deployment. By using the import.meta.glob method and the path replacement strategy, the system can ensure that the actual path of the module can be correctly parsed in different environments, avoiding the problem of unavailable functions caused by path errors. Through the technology of dynamic generation and batch loading, the project can quickly respond to the addition, deletion or modification of modules. Especially in large projects, there are many modules and they are updated frequently, and the traditional manual routing configuration method is difficult to meet flexible development needs. Automated routing generation and dynamic loading functions provide the system with higher scalability and adaptability.

[0067] In another embodiment of the present application, the method further includes: S21: When it is detected that a user logs in to the front-end page of the target project, a permission list corresponding to the user is obtained.

[0068] In this embodiment, the front-end page is a page that provides services to users after the target project is developed. The permission list is a list of permissions that the user has.

[0069] In this embodiment, when it is detected that a user has logged into the front-end page of the target project, the permission list of the user is queried on the back-end according to the user ID of the user.

[0070] S22: Determine the authority corresponding to the user according to the authority list.

[0071] In this embodiment, after obtaining the permission list of the user, the permission list is read to determine the permissions corresponding to the user.

[0072] S23: Determine the menu item and operation button corresponding to the user according to the authority corresponding to the user.

[0073] In this embodiment, the menu item corresponding to the user is the menu item that the user can access in the front page, and the operation button corresponding to the user is the operation button that the user can click in the front page. Each menu item and operation button has a corresponding module.

[0074] In this embodiment, after the authority corresponding to the user is determined, the menu items that the user can access and the operation buttons that the user can click can be determined according to the authority.

[0075] S24: According to the route of each module in the routing configuration table, the menu items and the operation buttons are loaded into the front-end page.

[0076] In this embodiment, after determining the menu items and operation buttons corresponding to the user, the background searches for the corresponding routing information in the routing configuration table, and then loads the menu items and operation buttons to the front-end page through the routing information for the user to access and operate.

[0077] In this embodiment, after the user logs in, the system returns a detailed list of permissions for the user from the backend, including page access permissions and operation level permissions. Through custom instructions, these permission information is automatically bound to the front-end menus and operation buttons of each module, realizing the automation of permission control. Only when the user has the corresponding permissions will the system display the corresponding menu items and operation buttons, which ensures the controllability and security of the function.

[0078] In this embodiment, the method further includes: S25: Monitoring the permission configuration of the target project.

[0079] In this embodiment, the background monitors the permission configuration, regularly obtains relevant information of the permission configuration, and makes timely responses when the permission configuration changes.

[0080] S26: When a change in the permission configuration corresponding to the user is detected, the permission list of the user is updated.

[0081] In this embodiment, when the background monitors the change of the permission configuration corresponding to the user, the user's permission list is updated and the changed content is added to the user's permission list.

[0082] S27: According to the updated permission list, the corresponding menu items and the operation buttons are loaded into the front-end page.

[0083] In this embodiment, after the permission list is updated, the number of menu items that the user can access and the number of operation buttons that can be clicked increases, and the increased menu items and operation buttons are loaded into the front-end page through the routes corresponding to them. These operations are hot-reloaded, that is, they can be refreshed while the user is accessing the page, ensuring that the user is not aware of the update when using it.

[0084] In this embodiment, in order to solve the problem of user permissions changing while the system is running (for example, the administrator adjusts the user's role or permissions), the module is designed with a hot reload function. By monitoring the changes in permission configuration in real time, the system can automatically refresh the front-end permission configuration and instantly adjust the display status of the menu and operation buttons on the page to ensure the real-time and accuracy of user permissions.

[0085] In another embodiment of the present application, the method further includes: S31: According to the routing object in the target project, obtain navigation bar configuration information, where the navigation bar configuration information at least includes menu items, paths, and icons.

[0086] In this embodiment, the tag (meta) parameters corresponding to each route are determined according to the route object in the target project, and then the navigation bar configuration information is obtained, including the menu items, paths, icons and other information corresponding to each module.

[0087] S32: Generate a corresponding navigation bar according to the navigation bar configuration information.

[0088] In this embodiment, after obtaining the navigation bar configuration information, a corresponding navigation bar is generated.

[0089] S33: Bind the external module path corresponding to each module to the jump address of the navigation bar.

[0090] In this embodiment, the external module path corresponding to each module is bound to the jump address of the navigation bar. When the user clicks the navigation bar, the background can determine the code path of the corresponding module based on the external module path, and then load the menu items, operation buttons and icons of the corresponding module.

[0091] S34: According to the authority configuration corresponding to each user, corresponding menu items and function buttons are displayed in the navigation bar of the front-end page of the target project corresponding to each user.

[0092] In this embodiment, the menu items that the user can access and the operation buttons that can be clicked are determined according to the user's corresponding permission configuration, and then the corresponding menu items and function buttons are displayed in the navigation bar of the front-end page of the target project corresponding to each user.

[0093] In this embodiment, the meta parameters are enumerated to obtain the navigation bar configuration information (menu items, paths, icons, etc.), and the navigation bar jump address is bound according to the component parameter. The navigation bar configuration is stored as a serializable structure, including the path and the required permission tags. The displayed items are filtered according to the path permission configuration information and rendered into the navigation bar page.

[0094] In another embodiment of the present application, users can be authenticated based on a token system, combined with fingerprint authentication and simple behavioral analysis to enhance the security of the system. For example, WebAuthn (a passwordless login technology based on the FIDO2 standard, designed to achieve user authentication through public key encryption) is integrated in the front-end application. The user registers fingerprint data in the system, and the system stores the generated public key and other authentication information on the server side as an optional secondary authentication. Use JWT (JSON Web Token, an open standard for securely transmitting information between network applications (RFC 7519), commonly used for authentication and authorization. JWT uses a compact, self-contained way to represent information, ensure the integrity and security of the information, and is easy to use and transmit) to store user information. After the user successfully passes the primary and secondary authentication, the system generates a JWT and passes it between the client and the server through the HTTP (Authorization) header. Write a token automatic refresh mechanism on the front end, set the token expiration time, and automatically send a refresh request to obtain a new token when the token is about to expire.

[0095] refer to Figure 2 , Figure 2 is a schematic diagram of a route loading process proposed in an embodiment of the present application, such as Figure 2 As shown, during project development, first load the routing module, write page files (configuration files), import configuration files in batches and parse the paths, replace internal paths with external paths and generate corresponding routes, map metadata to routing objects, dynamically load routing objects, bind the permissions of the functions corresponding to each module to the corresponding users, and when the user logs in, check the permissions the user has according to the permission list, and only display the menu items and operation buttons corresponding to the permissions the user has. When the permission configuration is updated, hot reload the update of the permission configuration.

[0096] In the above embodiments of the present application, the project directory structure is automatically associated with the routing configuration, so there is no need to manually write and maintain the routing configuration file. The management and maintenance process of the front-end routing is greatly simplified. The navigation bar configuration is dynamically generated and updated based on the automatically generated routing configuration, and the navigation content is dynamically adjusted by parsing the meta information. This technology realizes the automatic generation and intelligent update of the navigation bar, avoiding the complexity of manually configuring the navigation bar. The permission control system based on dynamic permission tags dynamically controls the display of DOM elements through custom instructions (such as v-permission), and combines user roles and permission tags for refined permission management. This method combines permission control with user behavior analysis to improve the security and flexibility of the system. An asynchronous configuration loading mechanism is implemented, which combines the dynamic import() function to load the configuration file on demand, and a deep merging algorithm is designed to support incremental updates. The algorithm can intelligently merge multi-layer nested configuration objects to ensure that the new configuration can cover or extend the existing configuration. Combine password-based primary authentication and fingerprint authentication (such as WebAuthn) for dual authentication, and dynamically adjust session management and permission display using user behavior data (such as click frequency, page dwell time). This method enhances the security and user experience of the authentication system.

[0097] In the above embodiments of the present application, the complexity of manually writing and maintaining routes is reduced by automatically generating routing and navigation configurations, which improves development efficiency, and is particularly suitable for large projects that require frequent additions and subtractions of functional modules. Asynchronous configuration loading combined with a deep merge algorithm improves the flexibility of configuration management, allowing the system to adapt to configuration changes and user needs in real time, providing a smooth and seamless operating experience, while reducing the maintenance burden on developers.

[0098] Based on the same inventive concept, an embodiment of the present application provides a route loading device. Figure 3 , Figure 3 FIG. 3 is a schematic diagram of a route loading device 300 proposed in an embodiment of the present application. Figure 3 As shown, the device comprises: A configuration file creation module, used to create a configuration file corresponding to each module in the main directory of the target project, wherein the configuration file at least includes metadata corresponding to the module; A routing configuration table building module, used to obtain the internal module path and module information corresponding to each module to build a routing configuration table; A path replacement module, used to replace the internal module path with an external module path in the routing configuration table, so that a user can access the module through the external module path; A mapping module, used to map the metadata in the configuration file to a routing object in the routing configuration table; The routing loading module is used to load the routing object into the target project.

[0099] Optionally, the device further comprises: A directory name acquisition module, used to obtain the directory name of each directory in the external module path; A code file path acquisition module, used to determine the code file path corresponding to each module according to the directory name; The path adding module is used to add the code file path to the routing configuration table so that the background of the target project obtains the module code of each module according to the code file path.

[0100] Optionally, the device further comprises: The permission list acquisition module is used to acquire the permission list corresponding to the user when it is detected that the user logs in to the front-end page of the target project; A permission determination module, used to determine the permission corresponding to the user according to the permission list; A menu item determination module, used to determine the menu item and operation button corresponding to the user according to the authority corresponding to the user; The menu item loading module is used to load the menu items and the operation buttons into the front-end page according to the routes of each module in the routing configuration table.

[0101] Optionally, the device further comprises: A monitoring module, used to monitor the permission configuration of the target project; A list updating module, used to update the permission list of the user when a change in the permission configuration corresponding to the user is detected; The hot reload module is used to load the corresponding menu items and the operation buttons into the front-end page according to the updated permission list.

[0102] Optionally, the routing configuration table construction module includes: A path determination submodule, used to scan the directory structure of the target project and determine the internal module path corresponding to the configuration file; The module information determination submodule is used to read the configuration file and obtain the module information corresponding to the configuration file; An array generation submodule, used to generate an array corresponding to the internal module path and the module information; The routing configuration table generation submodule is used to construct the routing configuration table according to the array.

[0103] Optionally, the routing loading module includes: A route determination submodule, used to determine the route corresponding to each module according to the route configuration table; A data storage submodule, used for storing the routing and permission configuration corresponding to each module in a project file of a preset format; The project file loading submodule is used to load the project file corresponding to each module into the target project.

[0104] Optionally, the device further comprises: A navigation bar configuration information acquisition module, used to acquire navigation bar configuration information according to the routing object in the target project, wherein the navigation bar configuration information at least includes menu items, paths, and icons; A navigation bar generation module, used to generate a corresponding navigation bar according to the navigation bar configuration information; Binding the external module path corresponding to each module to the jump address of the navigation bar; The menu item display module is used to display corresponding menu items and function buttons in the navigation bar of the front-end page of the target project corresponding to each user according to the authority configuration corresponding to each user.

[0105] Based on the same inventive concept, another embodiment of the present application provides a readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the route loading method described in any of the above embodiments of the present application are implemented.

[0106] Based on the same inventive concept, another embodiment of the present application provides an electronic device, Figure 4 It is a schematic diagram of an electronic device 400 proposed in an embodiment of the present application, including a memory 402, a processor 401 and a computer program stored in the memory and executable on the processor, and when the processor executes, the steps in the route loading method described in any of the above embodiments of the present application are implemented.

[0107] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0108] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0109] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, devices, or computer program products. Therefore, the embodiments of the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0110] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0111] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0112] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0113] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0114] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0115] The route loading method, device, equipment and storage medium provided by the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of ​​the present application. At the same time, for those skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.

Claims

1. A route loading method, characterized in that: The method comprises: In the main directory of each module of the target project, create a configuration file corresponding to the module, wherein the configuration file includes at least metadata corresponding to the module; Obtaining the internal module path and module information corresponding to each of the modules to construct a routing configuration table; In the routing configuration table, the internal module path is replaced with an external module path so that a user can access the module through the external module path; Mapping the metadata in the configuration file to a routing object in the routing configuration table; Load the routing object into the target project.

2. The route loading method according to claim 1, characterized in that: The method further comprises: Get the directory name of each directory in the external module path; According to the directory name, determine the code file path corresponding to each module; The code file path is added to the routing configuration table, so that the background of the target project obtains the module code of each module according to the code file path.

3. The route loading method according to claim 1, characterized in that: The method further comprises: When it is detected that a user logs in to the front-end page of the target project, obtaining a permission list corresponding to the user; Determine the permissions corresponding to the user according to the permission list; Determine the menu item and operation button corresponding to the user according to the authority corresponding to the user; According to the route of each module in the routing configuration table, the menu items and the operation buttons are loaded into the front-end page.

4. The method for loading a route according to claim 3, characterized in that: The method further comprises: Monitor the permission configuration of the target project; When a change in the permission configuration corresponding to the user is detected, updating the permission list of the user; According to the updated permission list, the corresponding menu items and the operation buttons are loaded into the front-end page.

5. The route loading method according to claim 1, characterized in that: According to the configuration file, the internal module path and module information corresponding to each module are obtained to construct a routing configuration table, including: Scan the directory structure of the target project to determine the internal module path corresponding to the configuration file; Read the configuration file to obtain module information corresponding to the configuration file; Generate an array corresponding to the internal module path and the module information; The routing configuration table is constructed according to the array.

6. The method for loading a route according to claim 1, characterized in that: The step of loading the routing object into the target project includes: According to the routing configuration table, determine the route corresponding to each module; The routing and permission configuration corresponding to each module is stored in a project file of a preset format; The project file corresponding to each module is loaded into the target project.

7. The route loading method according to claim 1, characterized in that: The method further comprises: According to the routing object in the target project, obtain navigation bar configuration information, the navigation bar configuration information at least including menu items, paths, and icons; Generate a corresponding navigation bar according to the navigation bar configuration information; Binding the external module path corresponding to each module to the jump address of the navigation bar; According to the authority configuration corresponding to each user, the corresponding menu items and function buttons are displayed in the navigation bar of the front-end page of the target project corresponding to each user.

8. A route loading device, characterized in that: The device comprises: A configuration file creation module, used to create a configuration file corresponding to each module in the main directory of the target project, wherein the configuration file at least includes metadata corresponding to the module; A routing configuration table building module, used to obtain the internal module path and module information corresponding to each module to build a routing configuration table; A path replacement module, used to replace the internal module path with an external module path in the routing configuration table, so that a user can access the module through the external module path; A mapping module, used to map the metadata in the configuration file to a routing object in the routing configuration table; The routing loading module is used to load the routing object into the target project.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps in the method according to any one of claims 1 to 7 are implemented.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.