Dynamic menu generation method, device, equipment and storage medium

By creating menu template files locally and recursively processing them to generate routing rules and dynamically rendering target menus, the problem of front-end menu development waiting for back-end menu management is solved, thus improving development efficiency.

CN113986217BActive Publication Date: 2025-11-21SHENZHEN TCL NEW-TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111202299.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-15
Publication Date
2025-11-21
Estimated Expiration
2041-10-15

AI Technical Summary

Technical Problem

In existing technologies, front-end menu development requires waiting for back-end menu management and user permission development to be completed, resulting in low development efficiency. Furthermore, storing menu and route files in front-end local configuration files is not conducive to rapid development.

Method used

By receiving menu generation commands, creating menu template files, writing the menu template files to the local file directory, performing recursive processing and routing rule generation, dynamically rendering the target menu, and decoupling backend development.

Benefits of technology

It enables the generation of target menus during rapid local development, improving the efficiency of front-end menu development and reducing reliance on back-end development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113986217B_ABST
    Figure CN113986217B_ABST
Patent Text Reader

Abstract

The application provides a dynamic menu generation method, device and equipment and a computer readable storage medium. The dynamic menu generation method comprises the following steps: receiving a menu generation command, creating a menu template file according to the menu generation command; creating a local file directory, writing the menu template file into the local file directory, generating a menu file; recursively processing the menu file, generating a routing rule, rendering the menu file according to the routing rule, and generating a target menu. The dynamic menu generation method realizes the generation of a menu file corresponding to a local file directory, realizes the rapid development of a menu under the premise of decoupling a back-end development, and improves the development efficiency of front-end menu development.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of Internet, in particular to a dynamic menu generation method, device, equipment and storage medium. BACKGROUND

[0002] At present, in the application development process, the control of menu routing in most platforms is based on backend interface calling, and the menu is modified through menu management. However, in the existing menu development process, due to different development progress, the front-end menu development often needs to wait for the back-end development menu management and user permission before continuing to develop, which is not conducive to the front-end menu development, resulting in low development efficiency, and there may be special needs to store the menu and routing file in the front-end local configuration file during the development process. The existing development method is not conducive to the demand of rapid development of application menu. SUMMARY

[0003] The embodiments of the present application provide a dynamic menu generation method, device, equipment and storage medium, aiming at solving the technical problem that the existing technology cannot realize rapid creation of menu based on local development.

[0004] In one aspect, the embodiments of the present application provide a dynamic menu generation method, which comprises the following steps:

[0005] receiving a menu generation command, creating a menu template file according to the menu generation command;

[0006] creating a local file directory, writing the menu template file into the local file directory, and generating a menu file;

[0007] recursively processing the menu file, generating a routing rule, rendering the menu file according to the routing rule, and generating a target menu.

[0008] In some embodiments of the present application, the step of receiving a menu generation command and creating a menu template file according to the menu generation command comprises:

[0009] parsing the menu generation command, creating a script file corresponding to the menu generation command, and calling the script file to read a unified template file;

[0010] rendering the unified template file according to the menu generation command to generate a menu template file.

[0011] In some embodiments of the present application, after the step of receiving a menu creation command and creating a menu template file, it further comprises:

[0012] parsing the menu generation command to obtain a calling interface corresponding to the menu command;

[0013] generate simulation data associated with the calling interface, and simulate the calling interface to return data based on the simulation data.

[0014] In some embodiments of the present application, the step of creating a local file directory, writing the menu template component into the local file directory, and generating a menu file comprises:

[0015] reading a corresponding local file in the local file directory, associating the local file with the menu template file, and establishing a menu mapping relationship;

[0016] rendering the menu template file according to the menu mapping relationship and the local file directory, and generating a menu file.

[0017] In some embodiments of the present application, the step of recursively processing the menu file, generating a routing rule, and rendering the menu file according to the routing rule to generate a target menu comprises:

[0018] reading the menu file, and recursively processing the menu file according to the routing rule to generate a routing tree;

[0019] establishing a routing configuration file associated with the menu file according to the routing tree;

[0020] rendering the menu file according to the routing configuration file to generate a target menu.

[0021] In some embodiments of the present application, the step of rendering the menu file according to the routing configuration file to generate a target menu comprises:

[0022] reading the routing configuration file, and obtaining a route associated with the menu file;

[0023] format-converting the route to obtain a rendering route;

[0024] parsing the menu file according to the rendering route to generate the target menu.

[0025] In some embodiments of the present application, after the step of recursively processing the menu file, generating a routing rule, and rendering the menu file according to the routing rule to generate a target menu, the method further comprises:

[0026] receiving a target menu access instruction, and obtaining permission data corresponding to the target menu access instruction;

[0027] reading the routing configuration file, and obtaining a specified route corresponding to the permission data;

[0028] controlling the target menu to display a menu view corresponding to the specified route.

[0029] In another aspect, the present application provides a dynamic menu generation device, comprising:

[0030] a template generation module configured to receive a menu generation command, create a menu template file according to the menu generation command;

[0031] a menu writing module configured to create a local file directory, write the menu template file into the local file directory, and generate a menu file;

[0032] a menu rendering module configured to recursively process the menu file, generate a routing rule, render the menu file according to the routing rule, and generate a target menu.

[0033] In another aspect, the present application also provides a dynamic menu generation device, comprising:

[0034] one or more processors;

[0035] a memory; and

[0036] one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the dynamic menu generation method.

[0037] In another aspect, the present application also provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is loaded by a processor to execute the steps in the dynamic menu generation method.

[0038] In the present application, by receiving a menu generation command, creating a menu template file according to the menu generation command in a local rapid development process, and creating a local file directory, writing the created menu template file into the local file directory according to a preset mapping, generating a menu file, recursively processing the menu file, generating a routing rule, rendering the menu file according to the routing rule, and generating a target menu, the menu can be rapidly developed based on the local file directory and the corresponding local file under the premise of decoupling backend development, the routing rule is obtained, the target menu is dynamically rendered according to the routing rule, and the development efficiency of front-end menu development is improved. BRIEF DESCRIPTION OF DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0040] Figure 1 A scene schematic diagram of a dynamic menu generation method of an embodiment of the present application;

[0041] Figure 2 A flowchart schematic diagram of one embodiment of a dynamic menu generation method in the embodiment of the present application;

[0042] Figure 3 A flowchart schematic diagram of another embodiment of a dynamic menu generation method provided in the embodiment of the present application;

[0043] Figure 4 A flowchart schematic diagram of another embodiment of a dynamic menu generation method provided in the embodiment of the present application;

[0044] Figure 5 A flowchart schematic diagram of one embodiment of dynamic rendering for a target menu in a dynamic menu generation method provided in the embodiment of the present application;

[0045] Figure 6 A structure schematic diagram of one embodiment of a dynamic menu generation apparatus provided in the embodiment of the present application;

[0046] Figure 7 A structure schematic diagram of one embodiment of a dynamic menu generation device provided in the embodiment of the present application. DETAILED DESCRIPTION

[0047] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the protection scope of the present application.

[0048] In the description of the present application, it should be understood that the terms “center”, “longitudinal”, “transverse”, “length”, “width”, “thickness”, “upper”, “lower”, “front”, “rear”, “left”, “right”, “vertical”, “horizontal”, “top”, “bottom”, “inner”, “outer” and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present application. In addition, the terms “first”, “second” are only for the purpose of description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Therefore, the features limited by “first”, “second” can explicitly or implicitly include one or more of the features. In the description of the present application, the meaning of “multiple” is two or more, unless otherwise specifically limited.

[0049] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or description." Any embodiment described as "exemplary" in this application is not necessarily to be construed as being more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use the invention. Details are set forth in the following description for purposes of explanation. It should be understood that those skilled in the art will recognize that the invention can be made without using these specific details. In other instances, well-known structures and processes will not be described in detail to avoid obscuring the description of the invention with unnecessary detail. Therefore, the invention is not intended to be limited to the embodiments shown, but is consistent with the broadest scope of the principles and features disclosed in this application.

[0050] Currently, in application development, menu routing in most platforms is controlled based on backend API calls, with menus modified through menu management. However, in rapid development and local development, due to different development progress, it is often necessary to wait for the backend to develop menu management and user permissions, which is detrimental to local development progress. Furthermore, there may be special requirements during development to store menu and routing files in a front-end local configuration file. The existing development method is not conducive to the needs of rapid application development. Based on this, this application proposes a dynamic menu generation method, apparatus, device, and computer-readable storage medium, which are described in detail below.

[0051] The dynamic menu generation method in this embodiment of the invention is applied to a dynamic menu generation device, which is configured in a dynamic menu generation equipment. The dynamic menu generation equipment includes one or more processors, a memory, and one or more application programs. The one or more application programs are stored in the memory and configured to be executed by the processor to implement the dynamic menu generation method. The dynamic menu generation equipment can be a smart terminal, such as a mobile phone, tablet computer, network device, and smart computer. Optionally, the dynamic menu generation equipment can also be a server or a service cluster composed of multiple servers.

[0052] like Figure 1 As shown, Figure 1 This is a schematic diagram of a scenario for a dynamic menu generation method according to an embodiment of this application. The dynamic menu generation scenario in this embodiment includes a dynamic menu generation device 100 (the dynamic menu generation device 100 integrates a dynamic menu generation apparatus), and a computer-readable storage medium corresponding to the dynamic menu generation method is running in the dynamic menu generation device 100 to execute the steps of the dynamic menu generation method.

[0053] This application provides a dynamic menu generation method, apparatus, and storage medium, which will be described in detail below.

[0054] Understandable, Figure 1 The dynamic menu generation device in the scenario of the dynamic menu generation method shown, or the devices included in the dynamic menu generation device, does not constitute a limitation on the embodiments of the present invention. That is, the number or type of devices included in the scenario of the dynamic menu generation method, or the number or type of devices included in each device, does not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be considered as equivalent substitutions or derivatives of the technical capabilities claimed in the embodiments of the present invention.

[0055] In this embodiment of the invention, the dynamic menu generation device 100 is mainly used for: receiving a menu generation command, creating a menu template file according to the menu generation command; creating a local file directory, writing the menu template file into the local file directory, and generating a menu file; recursively processing the menu file to generate routing rules, rendering the menu file according to the routing rules, and generating a target menu.

[0056] The dynamic menu generation device 100 in this embodiment of the invention can be an independent program development device or a program development cluster composed of program development devices. For example, the dynamic menu generation device 100 described in this embodiment of the invention includes, but is not limited to, devices such as mobile phones, computers, network hosts, and cloud servers.

[0057] Those familiar with this field will understand that Figure 1 The application environment shown is only one application scenario related to the solution of this application and does not constitute a limitation on the application scenario of this application. Other application scenarios may include more than one application scenario. Figure 1 The number of more or fewer dynamic menu generation devices shown, or the connection relationship of the dynamic menu generation network, for example... Figure 1 Only one dynamic menu generation device is shown in the text. It is understood that the scenario of this dynamic menu generation method may also include one or more other dynamic menu optimization devices, which are not limited here.

[0058] It should be noted that, Figure 1 The schematic diagram of the dynamic menu generation method shown is merely an example. The scenarios of the dynamic menu optimization method described in the embodiments of the present invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention.

[0059] Based on the scenarios described above for dynamic menu generation, this application proposes an embodiment of the dynamic menu generation method.

[0060] like Figure 2 As shown, Figure 2For an embodiment flowchart of the dynamic menu generation method in the embodiments of the present application, the dynamic menu generation method comprises the following steps 201-203:

[0061] 201, receiving a menu generation command, and creating a menu template file according to the menu generation command;

[0062] The dynamic menu generation method in the embodiments can be applied to a dynamic menu generation device, and the type and number of the dynamic menu generation device are not specifically limited, i.e., the dynamic menu generation device can be a smart terminal or a cloud server, etc. In a specific embodiment, the dynamic menu generation device is a computer.

[0063] Specifically, when the dynamic menu generation device is in a running state, the dynamic menu generation device receives a dynamic menu generation request of a user. The dynamic menu generation request is triggered by the user through a controller and a touch screen, etc. The dynamic menu generation device is requested to create a script file associated with a menu generation command according to the menu generation command carried in the dynamic menu generation request, to create a menu template file by calling the script file, to render the menu template file, and to generate a dynamic menu. The dynamic menu is a menu that displays a multi-level menu and can be dynamically managed through a specific management interface. In a specific embodiment, the script file is a Vue template script.

[0064] After the dynamic menu generation device obtains the menu generation command, the dynamic menu generation device reads the menu generation command and creates a menu template file according to the menu generation command. Specifically, the dynamic menu generation device reads the menu generation command to obtain menu creation information carried in the menu generation command. After obtaining the menu creation information, the dynamic menu generation device executes a script file, reads a unified template file, enters the menu creation information into the unified template file, and renders to obtain a menu template file. The menu template file is a default vue menu file that can be accessed based on the menu generation command. The menu creation information includes path name information and menu name information, etc., which are related to menu creation.

[0065] After the dynamic menu generation device creates the menu template file according to the menu generation command, the dynamic menu generation device associates the created menu template file with a local file directory.

[0066] 202, creating a local file directory, writing the menu template file into the local file directory, and generating a menu file;

[0067] In this embodiment, the dynamic menu generation device pre-creates a local file directory according to the directory creation command mkdirSync. After the local file directory is created, it performs file read and write operations on the local file directory according to the file write command writeFileSync, creating at least one local file in the local file directory.

[0068] Specifically, the dynamic menu generation device creates several local files in the local file directory based on the file write command, reads the local files in the local file directory, and associates the local files with the menu template file to establish a menu mapping relationship. More specifically, based on the path name and menu name information in the menu template file, the dynamic menu generation device reads the local files in the local file directory associated with that path name and menu name information, and establishes a one-to-one menu mapping relationship between the local files associated with that path name and menu name and the menu template file.

[0069] After establishing a menu mapping relationship by associating local files with menu template files, the menu template files are written to the local file directory according to the menu mapping relationship, and the menu template files are generated into menu files. These menu files are JOSN files created based on the menu template files and carrying the menu mapping relationship.

[0070] 203. Recursively process the menu file to generate routing rules, render the menu file according to the routing rules, and generate the target menu.

[0071] In this embodiment, after obtaining the menu file, the dynamic menu generation device recursively processes the menu file to obtain the routing rules of the menu file, renders the menu file according to the routing rules, and generates the target menu.

[0072] Specifically, the dynamic menu generation device obtains the menu list from the menu file, recursively processes the menu file based on the menu list, traverses the menus at each level in the menu file, and thus obtains the routing rules in the menu file.

[0073] After obtaining the routing rule, the dynamic menu generation device reads the routing rule, renders the menu file according to the routing rule, and parses the menu file into a target menu that the Vue program can recognize.

[0074] After generating the target menu, the dynamic menu generation device displays the target menu on the display interface, receives menu navigation requests from users, receives menu jump operation instructions in the menu navigation requests, reads the routing rules in the target menu, jumps to the route corresponding to the menu jump operation instruction, and displays the page corresponding to the menu jump operation instruction on the display interface.

[0075] In the embodiment, the dynamic menu generation device creates a menu template file according to a menu generation command, creates a local file directory, establishes a menu mapping relationship between the menu template file and a local file in the local file directory, writes the menu template file into the local file directory based on the menu mapping relationship, generates a menu file, recursively processes the menu file, parses the menu file into a target menu recognizable by a Vue program, dynamically generates the target menu according to the local file directory, does not need to interact with a backend menu management, and improves development efficiency.

[0076] As shown in Figure 3 , Figure 3 FIG. 1 is a flowchart of another embodiment of the dynamic menu generation method provided in the embodiments of the present application.

[0077] Based on the above embodiments, the dynamic menu generation method further includes steps 301-302:

[0078] 301: Analyze the menu generation command to obtain a calling interface corresponding to the menu command;

[0079] 302: Generate simulation data associated with the calling interface, and simulate the calling interface to return data based on the simulation data.

[0080] In the embodiment, the dynamic menu generation device analyzes a menu generation command input by a user, and generates a dynamic menu according to the menu generation command. Specifically, the dynamic menu generation device obtains calling interface (API) information corresponding to the menu generation command. The calling interface information is interface information that needs to access background calling data in a target menu application scenario.

[0081] After the dynamic menu generation device obtains the calling interface information in the menu generation command, the current development state of the calling interface is determined. In a specific embodiment, the current development state of the calling interface includes two development states: developed and not developed.

[0082] If the current development state of the calling interface is developed, the dynamic menu generation device sends an interface data request to the calling interface to obtain return data of the calling interface.

[0083] If the current development state of the calling interface is not developed, the dynamic menu generation device generates simulation data (MOCK) associated with the calling interface, and uses the simulation data as return data of the calling interface to render the target menu.

[0084] In one specific embodiment, the dynamic menu generation device parses the menu generation command, determines that the calling interface corresponding to the menu generation command is the login interface, obtains the current development status of the backend login interface, determines that the current development status of the login interface is not completed, generates simulated data associated with the login interface, and renders the target menu by simulating the return data of the login interface.

[0085] In this embodiment, the dynamic menu generation device parses the menu generation command, obtains the call interface information, and detects the current development status of the call interface corresponding to the call interface information. When the call interface is not fully developed, it generates simulated data associated with the call interface to simulate the return data of the call interface, thereby achieving rapid connection through simulated data and improving the efficiency of local dynamic menu generation.

[0086] like Figure 4 As shown, Figure 4 This is a flowchart illustrating another embodiment of the dynamic menu generation method provided in this application.

[0087] This application provides a specific embodiment for recursively processing a menu file, including the following steps 401 to 403.

[0088] 401. Read the menu file and recursively generate a routing tree from the menu file;

[0089] 402. Establish a routing configuration file associated with the menu file based on the routing tree;

[0090] 403. Render the menu file according to the routing configuration file to generate the target menu.

[0091] In this embodiment, after generating the menu file, the dynamic menu generation device recursively processes the menu file, iterates through all menus in the menu file, obtains routing rules, and generates a routing tree associated with the menu file based on the routing rules. The routing tree is a set of routes that depend on the routing rules to achieve target menu navigation.

[0092] The dynamic menu generation device, following the routing tree, combines the routing tree and other custom routes in the menu file to generate a routing configuration file, which serves as a unified routing entry point. This configuration file is then used to modify the routes in the menu file. The routing configuration file stores routing information associated with the menu file, including route names, route paths, menu titles, menu icons, and menu nodes.

[0093] Specifically, the dynamic menu generation device reads the route configuration file, reads the routes associated with the menu file, converts the format of the route, and converts the route into the rendering route required by the Vue application to render the menu file. After obtaining the rendering route, the menu file is parsed and rendered according to the rendering route, and the menu file is converted into the target menu, thus realizing the dynamic menu generation.

[0094] In this embodiment, the dynamic menu generation device generates a route tree by recursively processing the menu file, establishes a route configuration file based on the route tree, converts the routes into rendering routes required by the Vue application to render the menu file based on the route configuration file, and parses the menu file based on the rendering routes to generate the target menu. This enables dynamic rendering of the target menu based on the local file directory, thereby improving development speed.

[0095] like Figure 5 As shown, Figure 5 This is a flowchart illustrating an embodiment of the dynamic menu generation method provided in this application, which dynamically renders a target menu.

[0096] This application provides a specific embodiment for dynamically rendering a target menu, including the following steps 501 to 503:

[0097] 501. Receive the target menu access instruction and obtain the permission data corresponding to the target menu access instruction;

[0098] 502. Read the routing configuration file to obtain the specified route corresponding to the permission data;

[0099] 503. Control the target menu to display the menu view corresponding to the specified route.

[0100] In this embodiment, after generating the target menu, the dynamic menu generation device displays the target menu on the display interface and receives a target menu access command. This target menu access command is triggered by the user through control methods such as a controller or touchscreen, requesting access to the target menu. Upon receiving the target menu access command, the dynamic menu generation device obtains the permission data carried by the command and dynamically renders the target menu based on this permission data.

[0101] Optionally, the dynamic menu generation device presets different menu permissions. Different permission data correspond to different menu permissions, and different menu permissions correspond to different routes.

[0102] Specifically, the dynamic menu generation device determines the menu authority corresponding to the authority data after verifying the authority data of the target menu access instruction. A routing configuration file is read to determine the specified route that the authority data can access. The specified route corresponding to different authority data can be customized by an operation and maintenance personnel according to actual scene requirements.

[0103] Specifically, the dynamic menu generation device controls the target menu to load the corresponding specified route after determining the specified route corresponding to the authority data, prohibits loading the route that the authority data has no right to load, generates the menu view corresponding to the authority data, and displays the menu view corresponding to the authority data on the display interface.

[0104] In this embodiment, the dynamic menu generation device identifies the authority data carried in the target access instruction, determines the menu authority of the access user, reads the specified route corresponding to the menu authority from the routing configuration file according to the menu authority, controls the target menu to load the corresponding specified route, generates the menu view corresponding to the authority data, and displays the menu view on the display interface, thereby achieving dynamic rendering of the target menu and improving development speed.

[0105] To better implement the dynamic menu generation method in the embodiments of the present application, on the basis of the dynamic menu generation method, the embodiments of the present application further provide a dynamic menu generation device, as shown in Figure 6 Figure 6 FIG. 1 is a structural schematic diagram of an embodiment of the dynamic menu generation device provided in the embodiments of the present application. The dynamic menu generation device 600 includes:

[0106] The template generation module 601 is configured to receive a menu generation command and create a menu template file according to the menu generation command.

[0107] The menu writing module 602 is configured to create a local file directory and write the menu template file into the local file directory to generate a menu file.

[0108] The menu rendering module 603 is configured to recursively process the menu file, generate a routing rule, render the menu file according to the routing rule, and generate a target menu.

[0109] In some embodiments of the present application, the dynamic menu generation device receives a menu generation command, creates a menu template file according to the menu generation command, and includes:

[0110] The menu generation command is parsed, a script file corresponding to the menu generation command is created, and the script file is called to read a unified template file.

[0111] The unified template file is rendered according to the menu generation command to generate a menu template file.​

[0112] In some embodiments of the application, the dynamic menu generation apparatus receives a menu creation command, creates a menu template file, and further comprises:

[0113] parsing the menu generation command to obtain calling interface information corresponding to the menu generation command;

[0114] generating simulation data associated with the calling interface, and simulating return data of the calling interface based on the simulation data.

[0115] In some embodiments of the application, the dynamic menu generation apparatus creates a local file directory, writes the menu template component into the local file directory, and generates a menu file, comprising:

[0116] reading a corresponding local file in the local file directory, associating the local file with the menu template file, and establishing a menu mapping relationship;

[0117] rendering the menu template file according to the menu mapping relationship and the local file directory to generate a menu file.

[0118] In some embodiments of the application, the dynamic menu generation apparatus recursively processes the menu file, generates a routing rule, and renders the menu file according to the routing rule to generate a target menu, comprising:

[0119] reading the menu file and recursively processing the menu file to generate a routing tree;

[0120] establishing a routing configuration file associated with the menu file according to the routing tree;

[0121] rendering the menu file according to the routing configuration file to generate a target menu.

[0122] In some embodiments of the application, the dynamic menu generation apparatus renders the menu file according to the routing configuration file to generate a target menu, comprising:

[0123] reading the routing configuration file to obtain a route associated with the menu file;

[0124] format-converting the route to obtain a rendering route;

[0125] parsing the menu file according to the rendering route to generate the target menu.

[0126] In some embodiments of the application, the dynamic menu generation apparatus recursively processes the menu file, generates a routing rule, and renders the menu file according to the routing rule to generate a target menu, and further comprises:

[0127] Receive a target menu access instruction and obtain the permission data corresponding to the target menu access instruction;

[0128] Read the routing configuration file to obtain the specified route corresponding to the permission data;

[0129] Control the target menu to display the menu view corresponding to the specified route.

[0130] This invention also provides a dynamic menu generation device, such as... Figure 7 As shown, Figure 7 This is a schematic diagram of one embodiment of the dynamic menu generation device provided in this application.

[0131] The dynamic menu generation device integrates any of the dynamic menu generation apparatuses provided in the embodiments of the present invention, and the dynamic menu generation device includes:

[0132] One or more processors;

[0133] Memory; and

[0134] One or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor in the steps of the dynamic menu generation method described in any of the embodiments of the above-described dynamic menu generation method.

[0135] Specifically, a dynamic menu generation device may include components such as a processor 701 with one or more processing cores, a memory 702 with one or more computer-readable storage media, a power supply 703, and an input unit 704. Those skilled in the art will understand that... Figure 7 The structure of the dynamic menu generation device shown does not constitute a limitation on the dynamic menu generation device. It may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:

[0136] The processor 701 is the control center of the dynamic menu generation device. It connects various parts of the device via interfaces and lines, and executes software programs and / or modules stored in the memory 702, as well as calling data stored in the memory 702, to perform various functions and process data, thereby providing overall monitoring of the dynamic menu generation device. Optionally, the processor 701 may include one or more processing cores; preferably, it may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, while the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 701.

[0137] The memory 702 can be used to store software programs and modules, and the processor 701 can execute various function applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; and the data storage area can store data created according to the use of the dynamic menu generation device, etc. In addition, the memory 702 can include a high-speed random access memory, and can also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 702 can also include a memory controller to provide the processor 701 with access to the memory 702.

[0138] The dynamic menu generation device also includes a power supply 703 for powering various components. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to realize functions such as charge management, discharge management, and power consumption management through the power management system. The power supply 703 can also include one or more than one direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power state indicator, and the like.

[0139] The dynamic menu generation device can also include an input unit 704, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0140] Although not shown, the dynamic menu generation device can also include a display unit, etc., which will not be described here. In particular, in the present embodiment, the processor 701 in the dynamic menu generation device will load executable files corresponding to the processes of one or more than one application program into the memory 702 according to the following instructions, and run the application programs stored in the memory 702 by the processor 701, so as to realize various functions, as follows:

[0141] Receiving a menu generation command, and creating a menu template file according to the menu generation command;

[0142] Creating a local file directory, writing the menu template file into the local file directory, and generating a menu file;

[0143] Recursively processing the menu file, generating a routing rule, rendering the menu file according to the routing rule, and generating a target menu.

[0144] The above describes in detail the dynamic menu generation method provided by the embodiments of the present application. The principles and implementation manners of the present application are described by using the specific embodiments. The above embodiment descriptions are only used to help understand the method of the present application and its core idea. Meanwhile, for those skilled in the art, the specific implementation manners and application ranges will be changed according to the idea of the present application. In conclusion, the content of the present description should not be understood as a limitation of the present application.

Claims

1. A dynamic menu generation method, characterized by, The dynamic menu generation method comprises: receiving a menu generation command, and creating a menu template file according to the menu generation command; creating a local file directory, reading a local file associated with path name information and menu name information in the menu template file from the local file directory according to the path name information and the menu name information, associating the local file with the menu template file, establishing a menu mapping relationship, rendering the menu template file according to the menu mapping relationship and the local file directory, and generating a menu file; reading the menu file, recursively generating a route tree from the menu file, establishing a route configuration file associated with the menu file according to the route tree, rendering the menu file according to the route configuration file, and generating a target menu; after the receiving of the menu generation command and the creation of the menu template file according to the menu generation command, the method further comprises: parsing the menu generation command to obtain calling interface information corresponding to the menu generation command; determining a current development state of the calling interface corresponding to the menu generation command according to the calling interface information, wherein the current development state comprises two development states of having been developed and not having been developed; if the current development state of the calling interface is having been developed, sending an interface data request to the calling interface, obtaining return data of the calling interface, and rendering the target menu by using the return data; if the current development state of the calling interface is not having been developed, generating simulation data associated with the calling interface, simulating return data of the calling interface based on the simulation data, and rendering the target menu by using the return data.

2. The dynamic menu generation method of claim 1, wherein, The step of receiving the menu generation command and creating the menu template file according to the menu generation command comprises: parsing the menu generation command, creating a script file corresponding to the menu generation command, and reading a unified template file by using the script file; rendering the unified template file according to the menu generation command, and generating the menu template file.

3. The dynamic menu generation method of claim 1, wherein, The step of rendering the menu file according to the route configuration file and generating a target menu comprises: reading the route configuration file to obtain a route associated with the menu file; format-converting the route to obtain a rendering route; parsing the menu file according to the rendering route to generate the target menu.

4. The dynamic menu generation method of claim 3, wherein, After the step of recursively processing the menu file, generating a route rule, rendering the menu file according to the route rule, and generating a target menu, the method further comprises: receiving a target menu access instruction, and obtaining permission data corresponding to the target menu access instruction; reading the route configuration file to obtain a specified route corresponding to the permission data; controlling the target menu to display a menu view corresponding to the specified route.

5. A dynamic menu generation apparatus characterized by comprising: The dynamic menu generation device comprises: a template generation module configured to receive a menu generation command and create a menu template file according to the menu generation command; The menu writing module is configured to create a local file directory, read a local file associated with path name information and menu name information in the menu template file in the local file directory according to the path name information and the menu name information, associate the local file with the menu template file, establish a menu mapping relationship, render the menu template file according to the menu mapping relationship and the local file directory, and generate a menu file; The menu rendering module is configured to read the menu file, recursively generate a route tree from the menu file, establish a route configuration file associated with the menu file according to the route tree, render the menu file according to the route configuration file, and generate a target menu. After the receiving menu generation command and creating a menu template file according to the menu generation command, the method further includes: Parsing the menu generation command to obtain calling interface information corresponding to the menu generation command; Determining a current development state of the calling interface corresponding to the menu generation command according to the calling interface information, the current development state including two development states of having been developed and not having been developed; If the current development state of the calling interface is having been developed, sending an interface data request to the calling interface, obtaining return data of the calling interface, and rendering the target menu by using the return data; If the current development state of the calling interface is not having been developed, generating simulation data associated with the calling interface, simulating return data of the calling interface based on the simulation data, and rendering the target menu by using the return data.

6. A dynamic menu generation device characterized by comprising: The dynamic menu generation device includes: one or more processors; a memory; and one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the processor to implement the dynamic menu generation method in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps of the dynamic menu generation method in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Application menu configuration method and device, electronic equipment and storage medium

    CN111611036A