Menu operation method, device, storage medium and electronic device
By obtaining and independently processing the logic and display attributes in the menu configuration file, the business logic of the menu is simplified, the problem of slow menu response speed is solved, and faster menu running speed is achieved.
Patent Information
- Application Number
- CN202210137195.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2042-02-15
AI Technical Summary
The business logic of the menu in the prior art is complex, resulting in a slow response speed of the menu during runtime.
By obtaining the configuration file corresponding to the menu, the configuration file includes the logical attributes and display attributes of the function items. The data structure is consistent with the function items. The logic and display attributes are processed independently to realize the decoupling of the function items and simplify the business logic to improve the response speed.
The menu responds faster. By independently processing logic and display attributes, the business logic is simplified and the operating efficiency of the menu is improved.
Smart Images

Figure CN114546113B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a menu operation method, device, storage medium and electronic device. Background Art
[0002] With the development of technology, people can use various electronic devices to achieve certain functions. When letting an electronic device perform a certain function, the user can select the function to be performed according to the menu provided in the electronic device. However, in the related art, the business logic of the menu is relatively complex, and when the menu is running, the menu responds slowly during operation. Summary of the invention
[0003] The embodiments of the present application provide a menu operation method, device, storage medium and electronic device, which can improve the response speed of the menu during operation.
[0004] In a first aspect, an embodiment of the present application provides a method for operating a menu, comprising:
[0005] Acquire a configuration file corresponding to the menu, wherein the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items;
[0006] Displaying the function item according to the display attribute;
[0007] A trigger operation for the function item is received, and the trigger operation is responded to according to the logical attribute.
[0008] In a second aspect, an embodiment of the present application further provides a menu operation device, including:
[0009] An acquisition module, used to acquire a configuration file corresponding to a menu, wherein the configuration file includes configuration items corresponding to function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items;
[0010] A display module, used for displaying the function item according to the display attribute;
[0011] The response module is used to receive a trigger operation for the function item and respond to the trigger operation according to the logical attribute.
[0012] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program runs on a processor, the computer executes a method for operating a menu as provided in any embodiment of the present application.
[0013] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising a processor and a memory, wherein the memory has a computer program, and the processor calls the computer program to execute a menu operation method as provided in any embodiment of the present application.
[0014] The technical solution provided by the present application obtains a configuration file corresponding to a menu, wherein the configuration file includes configuration items corresponding to function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items, the function items are displayed according to the display attributes, a trigger operation for the function items is received, and the trigger operation is responded to according to the logical attributes. In the present application, by making the configuration items corresponding to each function item in the menu independent of each other, the logical attributes and display attributes corresponding to each configuration item are also independent of each other, and making the data structure of each configuration item consistent with the data structure of the function item, the functions in the menu are decoupled, the business logic is simplified, and the menu responds faster at runtime. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A first flow chart of a method for operating a menu provided in an embodiment of the present application.
[0017] Figure 2 A second flow chart of the menu operation method provided in the embodiment of the present application.
[0018] Figure 3 A schematic diagram of the structure of a menu operation device provided in an embodiment of the present application.
[0019] Figure 4 A first structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0020] Figure 5 A second structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all of 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 scope of protection of the present application.
[0022] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0023] The embodiment of the present application provides a method for operating a menu, and the execution subject of the method for operating the menu may be a menu operating device provided in the embodiment of the present application, or an electronic device integrated with the menu operating device, wherein the menu operating device may be implemented in hardware or software. The electronic device may be a smart phone, tablet computer, PDA, laptop computer, desktop computer or other device.
[0024] See also Figure 1 , Figure 1 This is a schematic diagram of a first flow chart of the menu operation method provided in the embodiment of the present application. The specific flow chart of the menu operation method provided in the embodiment of the present application can be as follows:
[0025] 101. Obtain a configuration file corresponding to the menu, where the configuration file includes configuration items corresponding to the function items in the menu, where the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items.
[0026] It can be understood that the menu includes multiple levels of function items. By classifying and dividing different function items into levels, a tree-structured menu can be formed. For example, the settings menu in a mobile phone takes the settings menu as the first-level function items. The first-level function items may include the second-level function items: display, sound, and brightness. The display function items in the second-level function items may include the third-level function items: graphic effects and backlight. For another example, the sound function items in the second-level function items may include the third-level function items: vibration, ringtones, and reminders, and so on.
[0027] It should be noted that this application completely separates the view layer, logic layer and data layer. Each function item in the menu provided in this case corresponds to a module logic layer as the view model (View Model) layer in the Model-View-ViewModel (MVVM) architecture. The logic layer of each module is completely independent, and the functions of each module are organized into a tree structure. Specifically, the functions of each module can be organized into a tree structure using JSON to achieve menu configurability.
[0028] In the embodiment of the present application, the logic attribute reflects the interaction logic between the functional items. The display attribute reflects the content to be displayed.
[0029] The configuration file corresponding to the menu is a source code file corresponding to the menu, for example, the source code file can be a java code file. The configuration file includes multiple sub-configuration files, each configuration item corresponds to a sub-configuration file, and the logical attributes and display attributes of the function item are reflected by its corresponding sub-configuration file.
[0030] For example, the information contained in each sub-configuration file may include the title name, explanation, icon, module logic layer displayed in the corresponding function item, and the function item information of the next level corresponding to the function item.
[0031] 102. Display function items according to display attributes.
[0032] In the embodiment of the present application, the function items in the menu can be displayed according to the display attributes.
[0033] 103. Receive a trigger operation for a function item, and respond to the trigger operation according to a logical attribute.
[0034] The trigger operation may be a click operation of a user on a certain function item, or may be a gesture operation specified for the function item, so that the function item can quickly respond to the user's operation.
[0035] In an embodiment of the present application, when a function item receives a trigger operation, it responds to the trigger operation according to logical properties. For example, taking the example in process 101, when the user triggers the second-level function item "Display" in the menu, according to the interaction logic between the function items, the menu display interface will jump to the third-level function items "Graphic Effects" and "Backlight" corresponding to the "Display" function item, so that the user can make settings corresponding to the function items.
[0036] In specific implementation, the present application is not limited by the execution order of the various steps described. If no conflict occurs, some steps can be performed in other orders or simultaneously.
[0037] As can be seen from the above, the menu operation method provided in the embodiment of the present application obtains a configuration file corresponding to the menu, the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items, the function items are displayed according to the display attributes, a trigger operation for the function items is received, and the trigger operation is responded to according to the logical attributes. In the present application, the configuration items corresponding to each function item in the menu are independent of each other, the logical attributes and display attributes corresponding to each configuration item are also independent of each other, and the data structure of each configuration item is consistent with the data structure of the function item, so that each function in the menu is decoupled, the business logic is simplified, and the menu responds faster during operation.
[0038] The method described in the above embodiments is further described in detail below with examples.
[0039] See also Figure 2 , Figure 2 A second flow chart of the menu operation method provided in the embodiment of the present application. The method includes:
[0040] 201. Obtain a configuration file corresponding to a menu, where the configuration file includes configuration items corresponding to function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items.
[0041] It can be understood that the menu includes multiple levels of function items. By classifying and dividing different function items into levels, a tree-structured menu can be formed. For example, the settings menu in a mobile phone takes the settings menu as the first-level function items. The first-level function items may include the second-level function items: display, sound, and brightness. The display function items in the second-level function items may include the third-level function items: graphic effects and backlight. For another example, the sound function items in the second-level function items may include the third-level function items: vibration, ringtones, and reminders, and so on.
[0042] It should be noted that this application completely separates the view layer, the logic layer, and the data layer. Each function item in the menu provided in this case corresponds to a logic layer as the view model layer in the model-view model-view architecture. The logic layer corresponding to each function item is completely independent, and each function item is organized into a tree structure. Specifically, each function item can be organized into a tree structure using JSON to achieve menu configurability.
[0043] In the embodiment of the present application, the logic attribute reflects the interaction logic between the functional items. The display attribute reflects the content to be displayed.
[0044] The configuration file corresponding to the menu is a source code file corresponding to the menu, for example, the source code file can be a java code file. The configuration file includes multiple sub-configuration files, each configuration item corresponds to a sub-configuration file, and the logical attributes and display attributes of the function item are reflected by its corresponding sub-configuration file.
[0045] For example, the information contained in each sub-configuration file may include the title name, explanation, icon, logical layer displayed in the corresponding function item, and the low-level function item information corresponding to the function item.
[0046] 202. Display the function item according to the display attribute.
[0047] In the embodiment of the present application, the function items in the menu can be displayed according to the display attributes.
[0048] 203. Receive a trigger operation for the function item, and respond to the trigger operation according to the logical attribute.
[0049] The trigger operation may be a click operation of a user on a certain function item, or may be a gesture operation specified for the function item, so that the function item can quickly respond to the user's operation.
[0050] In an embodiment of the present application, when a function item receives a trigger operation, it responds to the trigger operation according to logical properties. For example, taking the example in process 101, when the user triggers the second-level function item "Display" in the menu, according to the interaction logic between the function items, the menu display interface will jump to the third-level function items "Graphic Effects" and "Backlight" corresponding to the "Display" function item, so that the user can make settings corresponding to the function items.
[0051] 204. In response to the update operation on the menu, a menu tree file corresponding to the configuration file is obtained, where the configuration file is parsed and obtained by parsing the menu tree file.
[0052] In the embodiment of the present application, when an update operation for the menu is received, a menu tree file corresponding to the configuration file is obtained in response to the update operation.
[0053] The configuration file is obtained by parsing the menu tree file. For example, the menu tree file may be a JSON file, and a java code file is obtained after the JSON file is compiled.
[0054] 205. Update the menu tree file to update the menu.
[0055] In the embodiment of the present application, when the menu is updated, the menu tree file can be updated to update the menu.
[0056] In one implementation, the process of “updating the menu tree file” may include the following processes:
[0057] (1) Determine the target update position of the update operation in the menu tree file;
[0058] In the embodiment of the present application, the update operation may include operations such as adding new function items, modifying function items, and deleting function items.
[0059] For example, when the update operation is to add a new function item, you can write a JSON file corresponding to the new function item, and configure the new function item as a JsonObject to the corresponding position that needs to be displayed in the menu tree file. The corresponding position that needs to be displayed is the target update position.
[0060] When adding a new function item, the content that needs to be configured for the function item may include the module logic layer corresponding to the new function item, the displayed string identifier, the function explanation string identifier, the icon identifier, etc. The logic module layer mainly includes the function item type, display and hide conditions, specific settings and acquisition logic of the new function item.
[0061] For example, when the update operation is to modify a function item, the function item to be modified is determined. If the display name, explanation, icon and other information of the function item need to be modified, the corresponding modification position in the sub-configuration file corresponding to the configuration item of the function item to be modified is determined, and the modification position is the target update position. The target modification position can indicate the information that needs to be modified currently.
[0062] For example, when the update operation is to delete a function item, determine the function item to be deleted, find the location of the sub-configuration file corresponding to the configuration item of the function item to be deleted, and delete the function item to be deleted. The location is the target update location.
[0063] (2) Update the menu tree file according to the target update location.
[0064] It is understandable that after the target update position is determined, the menu tree file can be updated according to the target update position.
[0065] In one implementation, after the process of "updating the menu tree file", the following processes may also be included:
[0066] (1) Obtain the updated menu tree file;
[0067] In the embodiment of the present application, after the menu tree is updated, an updated menu tree file is obtained, and the updated menu tree file is acquired.
[0068] (2) parsing the updated menu tree file to generate an updated configuration file;
[0069] For example, by parsing the updated menu tree file, an updated java code file corresponding to the updated menu can be obtained.
[0070] (3) Compile the updated configuration file to generate a program installation package corresponding to the updated menu.
[0071] For example, the updated Java code file is compiled to generate a program installation package corresponding to the updated menu.
[0072] In one implementation, after the process of "generating a program installation package corresponding to the updated menu", the following process may also be included:
[0073] (1) in response to a startup operation on a program installation package, obtaining an updated configuration file;
[0074] It should be noted that the program installation package here is the program installation package corresponding to the updated menu, so when responding to the startup operation for the program installation package, the updated configuration file is obtained.
[0075] (2) drawing the updated menu according to the updated configuration file to generate a menu interface;
[0076] Among them, each configuration item in the updated configuration file corresponds to a sub-configuration file. When the updated menu is drawn according to the updated configuration file, the category of the function item in the updated menu can be obtained, and the hierarchical information corresponding to each sub-configuration file can be determined according to the category. Each sub-configuration file is named according to the hierarchical information corresponding to each sub-configuration file, and the name of each sub-configuration file is obtained. The updated menu is drawn according to the name of each sub-configuration file.
[0077] For example, when obtaining the category of the function items in the menu, the function items "graphic effects" and "backlight" both belong to the settings of the display parameter category and can be classified as the "display" function item, while the "display" function item belongs to the settings of the function selection category and can be classified as the "settings menu" function item. Therefore, the function items can be classified and hierarchically divided according to their categories, so as to obtain the hierarchical information corresponding to the sub-configuration files corresponding to the configuration items of the function items. For example, the hierarchical information of the "display" function item is the second level, and the hierarchical information of the function items "graphic effects" and "backlight" is the third level.
[0078] For example, when naming the sub-configuration file, the sub-configuration file corresponding to the configuration item of the first-level function item in the menu can be named VM0000An, the sub-configuration file corresponding to the configuration item of the second-level function item can be named VM000010An, VM000011An, VM000012An, and the sub-configuration file corresponding to the configuration item of the third-level function item can be named, for example, the sub-configuration file corresponding to the configuration item of the third-level function item under VM000010An can be named VM00001020An, VM00001021An, VM00001022An, VM00001023An… and so on.
[0079] (3) Receive operation instructions for the menu interface and respond to the operation instructions.
[0080] In an embodiment of the present application, a menu interface is generated after the menu is drawn, and the user can select the function item he wants to set through the menu interface. The menu responds to the operation instruction by receiving the operation instruction for the menu interface.
[0081] For example, when the operation instruction received on the menu interface is a trigger instruction for the "display" function item, the menu interface will jump to the third-level function items "graphic effects" and "backlight" corresponding to the "display" function item. For another example, under the "graphic effects" function item, the fourth-level function items correspond to "bright", "standard" and "smart". If the user continues to operate and triggers the "graphic effects" function item, the menu interface will jump to the function items "bright", "standard" and "smart". If the user further operates and selects the "standard" function item, the display graphic effect of the current electronic device is set to standard.
[0082] As can be seen from the above, the menu operation method proposed in the embodiment of the present application obtains a configuration file corresponding to the menu, the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items, the function items are displayed according to the display attributes, a trigger operation for the function items is received, and the trigger operation is responded to according to the logical attributes. In the present application, the configuration items corresponding to each function item in the menu are independent of each other, the logical attributes and display attributes corresponding to each configuration item are also independent of each other, and the data structure of each configuration item is consistent with the data structure of the function item, so that each function in the menu is decoupled, the business logic is simplified, and the menu responds faster during operation.
[0083] In one embodiment, a menu operation device is also provided. Figure 3 , Figure 3The schematic diagram of the structure of the menu operation device 300 provided in the embodiment of the present application. The menu operation device 300 is applied to an electronic device, and the menu operation device 300 includes an acquisition module 301, a display module 302 and a response module 303, as follows:
[0084] The acquisition module 301 is used to acquire a configuration file corresponding to the menu, wherein the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items;
[0085] Display module 302, used to display function items according to display attributes;
[0086] The response module 303 is used to receive a trigger operation for a function item and respond to the trigger operation according to a logical attribute.
[0087] In one implementation, the response module 303 may also be used to obtain a menu tree file corresponding to the configuration file in response to an update operation on the menu, where the configuration file is parsed from the menu tree file; and update the menu tree file to update the menu.
[0088] In one implementation, the response module 303 may also be used to determine a target update position of the update operation in the menu tree file; and update the menu tree file according to the target update position.
[0089] In one implementation, the response module 303 may also be used to obtain an updated menu tree file;
[0090] The updated menu tree file is parsed to generate an updated configuration file; the updated configuration file is compiled to generate a program installation package corresponding to the updated menu.
[0091] In one embodiment, the response module 303 can also be used to respond to the startup operation of the program installation package, obtain an updated configuration file; draw an updated menu according to the updated configuration file to generate a menu interface; receive operation instructions for the menu interface, and respond to the operation instructions.
[0092] In one embodiment, each configuration item in the updated configuration file corresponds to a sub-configuration file, and the response module 303 can also be used to obtain the category of the function item in the updated menu; determine the hierarchical information corresponding to each sub-configuration file according to the category; name each sub-configuration file according to the hierarchical information corresponding to each sub-configuration file to obtain the naming name of each sub-configuration file; and draw the updated menu according to the naming name of each sub-configuration file.
[0093] In one implementation, the menu tree file is a JSON file.
[0094] In one implementation, the configuration file is a java file.
[0095] It should be noted that the menu operating device provided in the embodiment of the present application belongs to the same concept as the menu operating method in the above embodiment. Any method provided in the menu operating method embodiment can be implemented through the menu operating device. The specific implementation process is detailed in the menu operating method embodiment, which will not be repeated here.
[0096] The present application also provides an electronic device. The electronic device may be a smart phone, a tablet computer, or other device. Figure 4 , Figure 4 The first structural diagram of the electronic device provided in the embodiment of the present application is as follows: The electronic device 400 includes a processor 401 and a memory 402. The processor 401 is electrically connected to the memory 402.
[0097] The processor 401 is the control center of the electronic device 400. It uses various interfaces and lines to connect various parts of the entire electronic device. It executes various functions of the electronic device and processes data by running or calling computer programs stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the electronic device as a whole.
[0098] The memory 402 may be used to store computer programs and data. The computer programs stored in the memory 402 include instructions that can be executed in the processor. The computer programs may constitute various functional modules. The processor 401 executes various functional applications and data processing by calling the computer programs stored in the memory 402.
[0099] In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to implement various functions:
[0100] Obtain a configuration file corresponding to the menu, the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items;
[0101] Display function items according to display attributes;
[0102] Receive trigger operations for function items and respond to the trigger operations based on logical attributes.
[0103] In one embodiment, see Figure 5 , Figure 5A second structural diagram of an electronic device provided in an embodiment of the present application. The electronic device 400 further includes: a radio frequency circuit 403, a display screen 404, a control circuit 405, an input unit 406, an audio circuit 407, a sensor 408, and a power supply 409. The processor 401 is electrically connected to the radio frequency circuit 403, the display screen 404, the control circuit 405, the input unit 406, the audio circuit 407, the sensor 408, and the power supply 409, respectively.
[0104] The radio frequency circuit 403 is used to send and receive radio frequency signals to communicate with network devices or other electronic devices through wireless communication.
[0105] The display screen 404 may be used to display information input by a user or information provided to a user and various graphical user interfaces of the electronic device. These graphical user interfaces may be composed of images, texts, icons, videos and any combination thereof.
[0106] The control circuit 405 is electrically connected to the display screen 404 and is used to control the display screen 404 to display information.
[0107] The input unit 406 can be used to receive input numbers, character information or user feature information (such as fingerprints), and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. The input unit 406 can include a fingerprint recognition module.
[0108] The audio circuit 407 can provide an audio interface between the user and the electronic device through a speaker and a microphone. The audio circuit 407 includes a microphone. The microphone is electrically connected to the processor 401. The microphone is used to receive voice information input by the user.
[0109] The sensor 408 is used to collect external environment information. The sensor 408 may include one or more sensors such as an environment brightness sensor, an acceleration sensor, and a gyroscope.
[0110] The power supply 409 is used to supply power to various components of the electronic device 400. In one implementation, the power supply 409 may be logically connected to the processor 401 through a power management system, so that the power management system can manage charging, discharging, power consumption, and other functions.
[0111] Although not shown in the figure, the electronic device 400 may also include a camera, a Bluetooth module, etc., which will not be described in detail here.
[0112] In this embodiment, the processor 401 in the electronic device 400 loads instructions corresponding to the processes of one or more computer programs into the memory 402 according to the following steps, and the processor 401 runs the computer programs stored in the memory 402 to implement various functions:
[0113] Obtain a configuration file corresponding to the menu, the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items;
[0114] Display function items according to display attributes;
[0115] Receive trigger operations for function items and respond to the trigger operations based on logical attributes.
[0116] In one embodiment, after executing and receiving a trigger operation for a function item and responding to the trigger operation according to a logical attribute, the processor 401 may also execute: in response to an update operation for a menu, obtaining a menu tree file corresponding to a configuration file, where the configuration file is parsed from the menu tree file; and updating the menu tree file to update the menu.
[0117] In one implementation, when executing the update of the menu tree file, the processor 401 may execute: determining a target update position of the update operation in the menu tree file; and updating the menu tree file according to the target update position.
[0118] In one embodiment, after updating the menu tree file, the processor 401 may also execute: obtaining the updated menu tree file; parsing the updated menu tree file to generate an updated configuration file; compiling the updated configuration file to generate a program installation package corresponding to the updated menu.
[0119] In one embodiment, after executing the program installation package corresponding to the generated updated menu, the processor 401 may also execute: in response to the startup operation of the program installation package, obtaining an updated configuration file; drawing the updated menu according to the updated configuration file to generate a menu interface; receiving operation instructions for the menu interface, and responding to the operation instructions.
[0120] In one embodiment, each configuration item in the updated configuration file corresponds to a sub-configuration file. When the processor 401 draws the updated menu according to the updated configuration file, it can execute: obtaining the category of the function item in the updated menu; determining the hierarchical information corresponding to each sub-configuration file according to the category; naming each sub-configuration file according to the hierarchical information corresponding to each sub-configuration file to obtain the naming name of each sub-configuration file; and drawing the updated menu according to the naming name of each sub-configuration file.
[0121] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program runs on a processor, the computer executes the menu operation method described in any of the above embodiments.
[0122] It should be noted that, a person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the storage medium can include but is not limited to: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0123] In addition, the terms "first", "second", and "third" in this application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or modules is not limited to the listed steps or modules, but some embodiments also include steps or modules that are not listed, or some embodiments also include other steps or modules inherent to these processes, methods, products, or devices.
[0124] The above is a detailed introduction to the menu operation method, device, storage medium and electronic device provided in the embodiments of the present application. 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 a limitation on the present application.
Claims
1. A menu operation method, characterized in that: include: Acquire a configuration file corresponding to the menu, wherein the configuration file includes configuration items corresponding to the function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items; Displaying the function item according to the display attribute; receiving a trigger operation for the function item, and responding to the trigger operation according to the logical attribute; Among them, each function item in the menu corresponds to a module logic layer as the view model layer in the MVVM architecture. The logic layer of each module is completely independent, and the functions of each module are organized into a tree structure; the configuration file includes multiple sub-configuration files, each configuration item corresponds to a sub-configuration file, and the logical attributes and display attributes of the function item are reflected by the corresponding sub-configuration file; the configuration items corresponding to each function item in the menu are independent of each other, and the logical attributes and display attributes corresponding to each configuration item are also independent of each other, and the data structure of each configuration item is consistent with the data structure of the function item, so that the various functions in the menu are decoupled.
2. The menu operation method according to claim 1, characterized in that: After receiving the trigger operation for the function item and responding to the trigger operation according to the logical attribute, the method further includes: In response to an update operation on the menu, a menu tree file corresponding to the configuration file is acquired, wherein the configuration file is obtained by parsing the menu tree file; The menu tree file is updated to update the menu.
3. The menu operation method according to claim 2, characterized in that: The updating of the menu tree file comprises: Determine a target update position of the update operation in the menu tree file; The menu tree file is updated according to the target update position.
4. The menu operation method according to claim 3, characterized in that: After the menu tree file is updated, the following steps are also included: Get the updated menu tree file; Parsing the updated menu tree file to generate an updated configuration file; The updated configuration file is compiled to generate a program installation package corresponding to the updated menu.
5. The menu operation method according to claim 4, characterized in that: After generating the program installation package corresponding to the updated menu, it also includes: In response to a startup operation on the program installation package, obtaining the updated configuration file; Drawing the updated menu according to the updated configuration file to generate a menu interface; Receive an operation instruction for the menu interface, and respond to the operation instruction.
6. The menu operation method according to claim 5, characterized in that: Each configuration item in the updated configuration file corresponds to a sub-configuration file, and drawing the updated menu according to the updated configuration file includes: Obtaining the category of the function item in the updated menu; Determine the level information corresponding to each of the sub-configuration files according to the category; Naming each sub-configuration file according to the hierarchical information corresponding to each sub-configuration file to obtain a name for each sub-configuration file; The updated menu is drawn according to the name of each sub-configuration file.
7. The menu operation method according to any one of claims 3 to 6, characterized in that: The menu tree file is a JSON file.
8. The menu operation method according to any one of claims 1 to 6, characterized in that: The configuration file is a java file.
9. A menu operation device, characterized in that: include: An acquisition module, used to acquire a configuration file corresponding to a menu, wherein the configuration file includes configuration items corresponding to function items in the menu, the configuration items include logical attributes and display attributes of the function items, and the data structure of the configuration items is consistent with the data structure of the function items; A display module, used for displaying the function item according to the display attribute; A response module, used for receiving a trigger operation for the function item and responding to the trigger operation according to the logical attribute; Among them, each function item in the menu corresponds to a module logic layer as the view model layer in the MVVM architecture. The logic layer of each module is completely independent, and the functions of each module are organized into a tree structure; the configuration file includes multiple sub-configuration files, each configuration item corresponds to a sub-configuration file, and the logical attributes and display attributes of the function item are reflected by the corresponding sub-configuration file; the configuration items corresponding to each function item in the menu are independent of each other, and the logical attributes and display attributes corresponding to each configuration item are also independent of each other, and the data structure of each configuration item is consistent with the data structure of the function item, so that the various functions in the menu are decoupled.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed on a processor, the computer is caused to execute the menu operation method according to any one of claims 1 to 8.
11. An electronic device comprising a processor and a memory, wherein the memory stores a computer program, characterized in that: The processor is used to execute the menu operation method according to any one of claims 1 to 8 by calling the computer program.
