CN117724702A - Component configuration generation method, device, computing equipment and computer storage medium - Google Patents

Component configuration generation method, device, computing equipment and computer storage medium Download PDF

Info

Publication number
CN117724702A
CN117724702A CN202311748951.2A CN202311748951A CN117724702A CN 117724702 A CN117724702 A CN 117724702A CN 202311748951 A CN202311748951 A CN 202311748951A CN 117724702 A CN117724702 A CN 117724702A
Authority
CN
China
Prior art keywords
component
attribute
annotation
code file
configuration list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311748951.2A
Other languages
Chinese (zh)
Inventor
郑翔
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Hode Information Technology Co Ltd
Original Assignee
Shanghai Hode Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Hode Information Technology Co Ltd filed Critical Shanghai Hode Information Technology Co Ltd
Priority to CN202311748951.2A priority Critical patent/CN117724702A/en
Publication of CN117724702A publication Critical patent/CN117724702A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a component configuration generation method, a device, a computing device and a computer storage medium. The method comprises the following steps: processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component; and traversing each component attribute in each component attribute configuration list in sequence, and if the component attribute has an attribute annotation, and the attribute annotation is a preset attribute annotation, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation. According to the scheme, the used atomic assembly can be automatically identified, and the attribute value of the atomic assembly is automatically applied to the configuration item of the target assembly attribute of the complex assembly, so that the configuration efficiency and the accuracy are effectively improved, the rendering effect is improved due to the improvement of the accuracy, and the problem of component rendering according to the error configuration is avoided.

Description

Component configuration generation method, device, computing equipment and computer storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and apparatus for generating component configuration, a computing device, and a computer storage medium.
Background
In component development of a visualization platform, more complex components are generally generated by combining based on atomic components, but developers still need to define form configuration items of the complex components in the visualization platform in full. Because the visual platform form configuration items corresponding to the complex components are all manually configured, the method is relatively time-consuming and labor-consuming and is easy to make mistakes in the configuration process. In addition, if the configuration items of the atomic components are updated, the configuration items of the complex components are also updated manually, so that the error rate is greatly increased, and further the later rendering effect is affected.
Disclosure of Invention
The purpose of the application is to provide a component configuration generation method, a device, a computing device and a computer storage medium, so as to solve the problems that in the prior art, the configuration time is long, the cost is high and errors are easy to occur because the configuration items of a visual platform form corresponding to a complex component are configured manually, and the complex component needs to be updated synchronously and manually when the configuration items of an atomic component are updated, so that the error rate is increased, and the later rendering effect is poor.
According to an aspect of the embodiment of the present application, there is provided a component configuration generating method, which generates a first component code file and a second component code file in advance, wherein a target component attribute in the second component code file is written with a preset attribute annotation, and the preset attribute annotation is used for indicating that an attribute value of the target component attribute extends to use an attribute value of the first component, and the method includes:
processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component;
and traversing each component attribute in each component attribute configuration list in sequence, and if the component attribute has an attribute annotation, and the attribute annotation is a preset attribute annotation, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation.
Further, the method further comprises: judging whether the component attribute has attribute annotation or not;
if the attribute annotation exists, analyzing the attribute annotation information according to the format of the key value to obtain analyzed attribute annotation information;
judging whether a preset field exists in the data key of the analyzed attribute annotation information;
If the preset field exists, determining the attribute annotation as the preset attribute annotation.
Further, the method further comprises: if the component attribute does not have the attribute annotation, or if the data key of the parsed attribute annotation information does not have the preset field, traversing each component attribute in each component attribute configuration list in sequence.
Further, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation further includes:
and replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component in the data value of the parsed attribute annotation information.
Further, processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component, where the component attribute configuration list of the second component further includes:
processing the first component code file and the second component code file to obtain component information of the first component and component information of the second component, and storing the component identification and the component information into a database in a key value pair form, wherein a data key is the component identification, and a data value is the component information;
And traversing each data key in the database in sequence, and analyzing the component information corresponding to the data key to obtain a component attribute configuration list corresponding to the component.
Further, the component information is in JSON format;
analyzing the component information corresponding to the data key, and obtaining a component attribute configuration list corresponding to the component further comprises:
and extracting a component attribute configuration list corresponding to the component from the component information corresponding to the data key according to the preset keyword.
Further, processing the first component code file and the second component code file to obtain component information of the first component and component information of the second component further includes:
performing lexical analysis and grammar analysis on the first component code file and the second component code file to generate a first abstract syntax tree corresponding to the first component code file and a second abstract syntax tree corresponding to the second component code file;
traversing the first abstract syntax tree to obtain the component information of the first component, and traversing the second abstract syntax tree to obtain the component information of the second component.
Further, traversing each data key in the database in turn further comprises:
judging whether all data keys in the database are processed completely;
If not, an unprocessed data key is read from the database.
Further, traversing each component attribute in each component attribute configuration list in turn further comprises:
judging whether all the component attributes in the component attribute configuration list are processed completely;
if not, reading an unprocessed component attribute from the component attribute configuration list;
if yes, judging whether all the data keys in the database are processed completely.
According to another aspect of the embodiments of the present application, there is provided a component configuration generating apparatus, which generates a first component code file and a second component code file in advance, wherein a target component attribute in the second component code file is written with a preset attribute annotation, the preset attribute annotation is used for indicating that an attribute value of the target component attribute extends to use an attribute value of the first component, and the apparatus includes:
the processing module is suitable for processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component;
the traversing module is suitable for traversing each component attribute in each component attribute configuration list in sequence;
And the replacing module is suitable for replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation if the attribute annotation exists in the component attribute and the attribute annotation is the preset attribute annotation.
According to yet another aspect of embodiments of the present application, there is provided a computing device comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface are communicated with each other through the communication bus;
the memory is used for storing at least one executable instruction, and the executable instruction enables the processor to execute the operation corresponding to the component configuration generating method.
According to still another aspect of the embodiments of the present application, there is provided a computer storage medium having at least one executable instruction stored therein, the executable instruction causing a processor to perform operations corresponding to the component configuration generating method described above.
According to the scheme provided by the embodiment of the application, the used atomic assembly can be automatically identified, and the attribute value of the atomic assembly is automatically applied to the configuration item of the target assembly attribute of the complex assembly, so that the configuration efficiency and the accuracy are effectively improved, the later-period rendering effect is further improved, the problem of assembly rendering according to the error configuration is avoided, various problems caused by manual configuration are avoided, such as long time consumption, high labor cost and easy error in manual configuration, and the complex assembly needs to be synchronously and manually updated when the configuration item of the atomic assembly is updated, so that the error rate is increased, and the problems of poor later-period rendering effect and the like are solved.
The foregoing description is only an overview of the technical solutions of the present application, and may be implemented according to the content of the specification in order to make the technical means of the present application more clearly understood, and in order to make the above-mentioned and other objects, features and advantages of the present application more clearly understood, the following detailed description of the present application will be given.
Drawings
Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the following detailed description of the preferred embodiments. The drawings are only for purposes of illustrating the preferred embodiments and are not to be construed as limiting the application. Also, like reference numerals are used to designate like parts throughout the figures. In the drawings:
FIG. 1 illustrates a flow diagram of a component configuration generation method according to one embodiment in the present application;
FIG. 2A illustrates a flow diagram of a component configuration generation method according to another embodiment in the present application;
FIG. 2B is a schematic diagram of a form configuration of a complex component;
FIG. 3 shows a schematic structural diagram of a component configuration generating device according to one embodiment in the present application;
FIG. 4 illustrates a structural schematic diagram of a computing device according to one embodiment in the present application.
Detailed Description
Exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
First, terms related to one or more embodiments of the present application will be explained.
Atomic assembly: components that are single in function and simple in logic are difficult to simplify themselves, and more complex components are typically generated based on atomic combinations.
JS AST: javascript Abstract Syntax Tree the JS abstract syntax tree, AST, is an abstract decomposition of JS code logic, which refines the computation logic of the code and stores it in tree form in computation order.
FIG. 1 illustrates a flow diagram of a component configuration generation method according to one embodiment in the present application. In order to enable the component configuration method in this embodiment to be normally executed, a first component code file and a second component code file need to be generated in advance, where the first component code file records source codes of the first component, and the first component is an atomic component, and the second component code file records source codes of the second component, where the second component is a complex component, and a target component attribute in the second component code file is written with a preset attribute annotation, where the preset attribute annotation is used to indicate that an attribute value of the target component attribute extends to use an attribute value of the first component, as shown in fig. 1, and the method includes the following steps:
Step S101, processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component.
Specifically, after a first component code file and a second component code file are generated in advance, the first component code file and the second component code file are read, source codes of the first component recorded in the first component code file are processed to obtain a component attribute configuration list of the first component, and source codes of the second component recorded in the second component code file are processed to obtain a component attribute configuration list of the second component. The source code records information such as component attributes, attribute values of the component attributes, attribute notes of the component attributes and the like in a component attribute configuration list, and of course, other information related to the component attributes can also be recorded, which is not listed here. It should be noted that some component properties may not have property notes written.
Step S102, traversing each component attribute in each component attribute configuration list in turn, and if the component attribute has an attribute annotation, and the attribute annotation is a preset attribute annotation, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation.
Specifically, the attribute annotation is used for describing the component attribute, and after the component attribute configuration list is obtained, each component attribute in each component attribute configuration list is traversed in sequence, so that the following judgment needs to be made: judging whether the component attribute has the attribute annotation or not, judging whether the attribute annotation is a preset attribute annotation or not, if the component attribute has the attribute annotation, and the attribute annotation is the preset attribute annotation, determining that the component attribute of the component extends to use the component attribute of a certain atomic component, wherein the component attribute of which atomic component is used for extension can be obtained from the preset attribute annotation, and then replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value of the component attribute configuration list of the component used in the preset attribute annotation.
According to the scheme, the used atomic assembly can be automatically identified, the attribute value of the atomic assembly is automatically applied to the configuration item of the target assembly attribute of the complex assembly, so that the configuration efficiency and the accuracy are effectively improved, the later-period rendering effect is improved due to the improvement of the accuracy, the problem of assembly rendering according to the error configuration is avoided, various problems caused by manual configuration are avoided, such as long time consumption, high labor cost and easy error in manual configuration, and the complex assembly needs synchronous manual update when the configuration item of the atomic assembly is updated, so that the error rate is increased, and the problems of poor later-period rendering effect and the like are solved.
Fig. 2A shows a flow diagram of a component configuration generation method according to another embodiment in the present application. In order to enable the component configuration method in this embodiment to be normally executed, a first component code file and a second component code file need to be generated in advance, where the first component code file records source codes of the first component, the second component code file records source codes of the second component, and a target component attribute in the second component code file is written with a preset attribute annotation, where the preset attribute annotation is used to indicate that an attribute value of the target component attribute extends to use an attribute value of the first component, as shown in fig. 2A, and the method includes the following steps:
step S201, processing the first component code file and the second component code file to obtain component information of the first component and component information of the second component, and storing the component identifier and the component information in a database in a key value pair form, wherein a data key is the component identifier, and a data value is the component information.
Specifically, after the first component code file and the second component code file are generated in advance, the first component code file and the second component code file are read, and the source code of the first component recorded in the first component code file is processed, for example, the source code in the first component code file and the source code in the second component code file are subjected to structural conversion through a jsast tool, so that component information of the first component and component information of the second component are obtained. After obtaining the component information of the first component and the component information of the second component, storing the component identifier and the component information in a database in the form of key value pairs, for example, putting the component identifier and the component information into a MAP, where the MAP is a data structure capable of storing the key value pairs, the data key is the component identifier, the data value is the component information, and the component information is the information related to the component.
In an optional embodiment of the present application, the processing of the first component code file and the second component code file to obtain component information of the first component and component information of the second component may further be implemented by the following method:
performing lexical analysis and grammar analysis on the first component code file and the second component code file to generate a first abstract syntax tree corresponding to the first component code file and a second abstract syntax tree corresponding to the second component code file;
traversing the first abstract syntax tree to obtain the component information of the first component, and traversing the second abstract syntax tree to obtain the component information of the second component.
Specifically, for a first component code file, dividing the whole code character string in the first component code file into a minimum grammar unit array by using a lexical analyzer, and establishing a relation between analysis grammar units by using the grammar analyzer on the basis of word segmentation so as to generate a first abstract grammar tree corresponding to the first component code file; for the second component code file, the whole code string in the second component code file is segmented into a minimum grammar unit array by using a lexical analyzer, the grammar analyzer establishes a relation between analysis grammar units on the basis of the segmentation so as to generate a second abstract grammar tree corresponding to the second component code file, the first abstract grammar tree and the second abstract grammar tree are json structures, the first abstract grammar tree stores component information of a first component in a tree structure, the component information of the first component is distributed and stored in each node in the first abstract grammar tree, the second abstract grammar tree stores component information of the second component in a tree structure, and the component information of the second component is distributed and stored in each node in the second abstract grammar tree. Traversing the first abstract syntax tree to obtain the component information of the first component, and traversing the second abstract syntax tree to obtain the component information of the second component.
After the component identifier and the component information are stored in the database in the form of key value pairs, each data key in the database needs to be traversed in sequence, and subsequent processing is carried out on the component information corresponding to the data key, and specifically, the method can be realized as follows:
step S202, judging whether all data keys in a database are processed completely; if not, executing step S203; if so, the method ends.
In this embodiment, after reading an unprocessed data key from the database, a first preset flag is filled in a flag field corresponding to the data key in the database, for example, the first preset flag is read, or the first preset flag is 1, where 1 indicates that the unprocessed data key is read, and for the unprocessed data key, a second preset flag may be filled in a flag field corresponding to the data key, for example, the second preset flag is unread, and the second preset flag is 0, where 0 indicates that the unprocessed data key is read, so it may be determined that all the data keys in the database are not processed completely by determining whether the flag fields corresponding to the data keys in the database are all the first preset flags, or determining whether the flag fields are the second preset flag data keys, if not, and performing step S203; if yes, it can be determined that all data keys in the database are processed completely, the method is finished, and the component information stored in the database is configured information.
Step S203, a data key which is not processed is read from the database, component information corresponding to the data key is analyzed, and a component attribute configuration list corresponding to the component is obtained.
In the case that all the data keys in the database are not processed completely, one unprocessed data key can be read from the database, for example, one data key with an empty mark field can be read randomly from the database, or one data key with a mark field being a second preset mark can be read randomly, then component information corresponding to the read data key is analyzed, for example, a component attribute configuration list corresponding to the component can be extracted through a keyword recognition mode.
In an optional implementation mode of the application, the component information is component information in a JSON format, the JSON format has the characteristics of simplicity, strong readability and the like, a character string of the JSON is wrapped by double quotation marks, colon separation is used between keys and values, and comma separation is used between key-value pairs. Therefore, the component information is also in a key value pair format, the component information corresponding to the data key is analyzed, and the obtaining of the component attribute configuration list corresponding to the component can be further realized by the following method: and extracting a component attribute configuration list corresponding to the component from the component information corresponding to the data key according to the preset keyword, for example, if the preset keyword is a component attribute, then the component attribute can be found from the component information corresponding to the data key according to the preset keyword 'component attribute', and an attribute value, an attribute annotation and the like of the component attribute to generate the component attribute configuration list corresponding to the component.
Analyzing the component information corresponding to the data key to obtain a component attribute configuration list corresponding to the component, and traversing each component attribute in the component attribute configuration list according to the component attribute configuration list, wherein the method can be concretely realized as follows:
step S204, judging whether all the component attributes in the component attribute configuration list are processed completely; if not, executing step S205; if yes, step S202 is executed.
In this embodiment, after reading an unprocessed component attribute from the component attribute configuration list, a first preset flag is filled in a flag field corresponding to the component attribute in the component attribute configuration list, for example, the first preset flag is read, or the first preset flag is 1, where 1 indicates that the unprocessed component attribute may be read, and a second preset flag is filled in a flag field corresponding to the component attribute, for example, the second preset flag is unread, and the second preset flag is 0, where 0 indicates that the processing is performed, so that step S205 may be performed by determining whether the flag fields corresponding to the component attributes in the component attribute configuration list are all the first preset flag, or whether the flag fields in the component attribute configuration list are component attributes with the second preset flag, or if not, it may be determined that all the component attributes in the component attribute configuration list are not processed completely; if so, it may be determined that all the component attributes in the component attribute configuration list have been processed, and the step S202 is skipped.
In step S205, an unprocessed component attribute is read from the component attribute configuration list.
In the case that all the component attributes in the component attribute configuration list are not processed completely, an unprocessed component attribute may be read from the component attribute configuration list, for example, a component attribute with a flag field being empty may be read randomly from the component attribute configuration list, or a component attribute with a flag field being a second preset flag may be read randomly.
Step S206, judging whether the component attribute has attribute annotation; if yes, go to step S207; if not, step S204 is performed.
For the read unprocessed component attribute, it is required to first determine whether there is an attribute annotation of the component attribute, where the attribute annotation is usually marked with a form of "///", so that the information beginning with "//", if there is a match, the step S207 is performed in a skip manner, if there is no match, the step S204 is performed in a skip manner for the component attribute, and if there is no attribute annotation of the component attribute, the subsequent processing is not continued for the component attribute.
Step S207, analyzing the attribute annotation information according to the format of the key value to obtain the analyzed attribute annotation information.
In this embodiment, if the attribute annotation is a preset attribute annotation, the format of the attribute annotation is generally: the number of data bits of the preset field is fixed, for example, the number of data bits corresponding to the preset field is 6, so that the attribute annotation information can be divided according to the number of data bits, the attribute annotation information can be divided into two parts, and the attribute annotation information after the two parts are divided according to a key value pair format is respectively used as a data key and a data value.
Step S208, judging whether a preset field exists in the data key of the analyzed attribute annotation information; if yes, go to step S209; if not, step S204 is performed.
After the parsing according to step S207, for example, it is determined whether a preset field exists in the data key of the parsed attribute annotation information, where the preset field is "extended" or "used", etc., where it is determined whether the preset field exists in the data key of the parsed attribute annotation information mainly to determine whether the attribute annotation is a preset attribute annotation, if the preset field exists, it may be determined that the attribute annotation is a preset attribute annotation, and step S209 is performed; if the preset field does not exist, it may be determined that the attribute annotation is not the preset attribute annotation, and the step S204 is performed in a jump.
In step S209, the attribute annotation is determined to be a preset attribute annotation.
When it is determined that the preset field exists in the data key of the parsed attribute annotation information, the attribute annotation may be determined to be a preset attribute annotation, that is, an annotation that extends the attribute using the atomic component.
Step S210, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component in the data value of the parsed attribute annotation information, and jumping to execute step S204.
In the case where it is determined that the attribute annotation is the preset attribute annotation, the attribute value corresponding to the component attribute in the component attribute configuration list may be replaced with the attribute value in the component attribute configuration list of the component in the data value of the parsed attribute annotation information, where all the attribute values in the component attribute configuration list of the component in the data value of the parsed attribute annotation information are configured to the component attribute, for example, three attribute values in the component attribute configuration list of the component in the data value of the parsed attribute annotation information are configured to the component attribute, and then step S204 is performed in a skip mode.
In an optional embodiment of the present application, when it is determined that the component attribute has the attribute annotation, whether the attribute annotation information includes a preset field may be directly determined, if the attribute annotation includes the preset field, the attribute annotation is determined to be the preset attribute annotation, the attribute annotation information is divided according to the preset field, the attribute annotation information is divided into two parts, such as a first division part and a second division part, and the attribute value of the component attribute in the component attribute configuration list is replaced by the attribute value in the component attribute configuration list of the component recorded in the second division part, for example, the attribute annotation information is: the component attribute configuration list is divided into a first partition part and a second partition part, wherein the first partition part is a, and the second partition part is a, and the component attribute configuration list is used for replacing the component attribute value in the component attribute configuration list with the component attribute value in the component attribute configuration list of the component A.
In an alternative embodiment of the present application, the method further includes: if the component attribute does not have the attribute annotation, or if the data key of the parsed attribute annotation information does not have the preset field, traversing each component attribute in each component attribute configuration list in sequence.
The number of the first component code file and the second component code file is not limited in the present application, and when there are many complex components or component attributes of a complex component extended to use a plurality of atomic components, the number of the first component code file and the second component code file is plural.
The following describes, in connection with specific examples, the pre-generation of atomic components: component code file of button component, complex component: a component code file of the focus button component (as shown in fig. 2B), in which, for component attribute X, attribute notes are written: the/(@ extend button) does not write an attribute annotation for the other component attribute M.
Reading the component code file of the button component and the component code file of the attention button component, processing the component code file of the button component and the component code file of the attention button component according to the method in the embodiment shown in fig. 2A, by which the attribute value of the component attribute X of the attention button component is replaced with the attribute value in the component attribute configuration list of the button component, for example, the button component has the following component attributes: the wide, high and background pictures are that each component attribute corresponds to a corresponding attribute value, so that the attribute values of all component attributes of the button component are configured to the attribute X, and thus the configuration items of the component attributes of the button component can be automatically applied to the configuration items of the component attribute X of the concerned button component without manual configuration.
It should be noted that, the source code in the first component code file and the source code in the second component code file are not modified, but only the component information in the database is modified.
According to the scheme, the used atomic assembly can be automatically identified, the attribute value of the atomic assembly is automatically applied to the configuration item of the target assembly attribute of the complex assembly, so that the configuration efficiency and the accuracy are effectively improved, the later-period rendering effect is improved due to the improvement of the accuracy, the problem of assembly rendering according to the error configuration is avoided, various problems caused by manual configuration are avoided, such as long time consumption, high labor cost and easy error in manual configuration, and the complex assembly needs synchronous manual update when the configuration item of the atomic assembly is updated, so that the error rate is increased, and the problems of poor later-period rendering effect and the like are solved.
Fig. 3 shows a schematic structural diagram of a component configuration generating apparatus according to one embodiment in the present application. A first component code file and a second component code file are generated in advance, wherein a preset attribute annotation is written on a target component attribute in the second component code file, and the preset attribute annotation is used for indicating an attribute value extension of the target component attribute to use an attribute value of the first component, and as shown in fig. 3, the device comprises:
The processing module 301 is adapted to process the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component;
a traversing module 302 adapted to sequentially traverse each component attribute in each component attribute configuration list;
the replacing module 303 is adapted to replace the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation if the attribute annotation exists for the component attribute and the attribute annotation is the preset attribute annotation.
Optionally, the apparatus further comprises: the first judging module is suitable for judging whether the attribute annotation exists in the component attribute;
the analysis module is suitable for analyzing the attribute annotation information according to the format of the key value if the attribute annotation exists, so as to obtain the analyzed attribute annotation information;
the second judging module is suitable for judging whether a preset field exists in the data key of the analyzed attribute annotation information;
and the determining module is suitable for determining the attribute annotation as the preset attribute annotation if the preset field exists.
Optionally, the traversal module is further adapted to: if the component attribute does not have the attribute annotation, or if the data key of the parsed attribute annotation information does not have the preset field, traversing each component attribute in the component attribute configuration list in sequence.
Optionally, the replacement module is further adapted to: and replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component in the data value of the parsed attribute annotation information.
Optionally, the processing module is further adapted to: processing the first component code file and the second component code file to obtain component information of the first component and component information of the second component, and storing the component identification and the component information into a database in a key value pair form, wherein a data key is the component identification, and a data value is the component information;
and traversing each data key in the database in sequence, and analyzing the component information corresponding to the data key to obtain a component attribute configuration list corresponding to the component.
Optionally, the component information is JSON-format component information;
the processing module is further adapted to: and extracting a component attribute configuration list corresponding to the component from the component information corresponding to the data key according to the preset keyword.
Optionally, the processing module is further adapted to: performing lexical analysis and grammar analysis on the first component code file and the second component code file to generate a first abstract syntax tree corresponding to the first component code file and a second abstract syntax tree corresponding to the second component code file;
Traversing the first abstract syntax tree to obtain the component information of the first component, and traversing the second abstract syntax tree to obtain the component information of the second component.
Optionally, the processing module is further adapted to: judging whether all data keys in the database are processed completely;
if not, an unprocessed data key is read from the database.
Optionally, the traversal module is further adapted to: judging whether all the component attributes in the component attribute configuration list are processed completely;
if not, reading an unprocessed component attribute from the component attribute configuration list;
if yes, judging whether all the data keys in the database are processed completely.
According to the scheme, the used atomic assembly can be automatically identified, the attribute value of the atomic assembly is automatically applied to the configuration item of the target assembly attribute of the complex assembly, so that the configuration efficiency and the accuracy are effectively improved, the later-period rendering effect is improved due to the improvement of the accuracy, the problem of assembly rendering according to the error configuration is avoided, various problems caused by manual configuration are avoided, such as long time consumption, high labor cost and easy error in manual configuration, and the complex assembly needs synchronous manual update when the configuration item of the atomic assembly is updated, so that the error rate is increased, and the problems of poor later-period rendering effect and the like are solved.
The embodiment of the application also provides a non-volatile computer storage medium, which stores at least one executable instruction, and the computer executable instruction can execute the component configuration generating method in any of the method embodiments.
FIG. 4 illustrates a schematic diagram of a computing device according to one embodiment of the application, the particular embodiments of which are not limiting on the particular implementation of the computing device.
As shown in fig. 4, the computing device may include: a processor 402, a communication interface (Communications Interface) 404, a memory 406, and a communication bus 408.
Wherein: processor 402, communication interface 404, and memory 406 communicate with each other via communication bus 408.
A communication interface 404 for communicating with network elements of other devices, such as clients or other servers.
Processor 402, configured to execute program 410, may specifically perform relevant steps in the above-described component configuration generation method embodiment.
In particular, program 410 may include program code including computer-operating instructions.
The processor 402 may be a central processing unit CPU, or a specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement embodiments of the present application. The one or more processors included by the computing device may be the same type of processor, such as one or more CPUs; but may also be different types of processors such as one or more CPUs and one or more ASICs.
Memory 406 for storing programs 410. Memory 406 may comprise high-speed RAM memory or may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
Program 410 may be specifically operative to cause processor 402 to perform the component configuration generation method of any of the method embodiments described above. The specific implementation of each step in the procedure 410 may refer to the corresponding step and corresponding description in the unit in the above component configuration generating embodiment, which is not described herein. It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus and modules described above may refer to corresponding procedure descriptions in the foregoing method embodiments, which are not repeated herein.
The algorithms or displays presented herein are not inherently related to any particular computer, virtual system, or other apparatus. Various general-purpose systems may also be used with the teachings herein. The required structure for a construction of such a system is apparent from the description above. In addition, embodiments of the present application are not directed to any particular programming language. It will be appreciated that a variety of programming languages may be used to implement the teachings of the present application as described herein, and the above description of specific languages is provided for disclosure of preferred embodiments of the present application.
In the description provided herein, numerous specific details are set forth. However, it is understood that embodiments of the present application may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the above description of exemplary embodiments of the application, various features of embodiments of the application are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the application and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed application requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this application.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the present application and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Various component embodiments of the present application may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. Those skilled in the art will appreciate that some or all of the functionality of some or all of the components according to embodiments of the present application may be implemented in practice using a microprocessor or Digital Signal Processor (DSP). The present application may also be embodied as an apparatus or device program (e.g., computer program and computer program product) for performing a portion or all of the methods described herein. Such a program embodying the present application may be stored on a computer readable medium, or may have the form of one or more signals. Such signals may be downloaded from an internet website, provided on a carrier signal, or provided in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the application, and that those skilled in the art will be able to design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The application may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The use of the words first, second, third, etc. do not denote any order. These words may be interpreted as names. The steps in the above embodiments should not be construed as limiting the order of execution unless specifically stated.

Claims (12)

1. A component configuration generating method, which generates a first component code file and a second component code file in advance, wherein a target component attribute in the second component code file is written with a preset attribute annotation, and the preset attribute annotation is used for indicating an attribute value extension of the target component attribute to use an attribute value of the first component, the method comprises:
processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component;
and traversing each component attribute in each component attribute configuration list in sequence, and if attribute annotation exists in the component attribute and the attribute annotation is preset attribute annotation, replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation.
2. The method of claim 1, wherein the method further comprises:
judging whether the component attribute has attribute annotation or not;
if the attribute annotation exists, analyzing the attribute annotation information according to the format of the key value to obtain analyzed attribute annotation information;
Judging whether a preset field exists in the data key of the analyzed attribute annotation information;
and if the preset field exists, determining the attribute annotation as a preset attribute annotation.
3. The method of claim 2, wherein the method further comprises: if the component attribute does not have the attribute annotation, or if the data key of the parsed attribute annotation information does not have the preset field, traversing each component attribute in each component attribute configuration list in sequence.
4. A method according to claim 2 or 3, wherein said replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation further comprises:
and replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component in the data value of the parsed attribute annotation information.
5. The method according to any one of claims 1-4, wherein the processing the first component code file and the second component code file to obtain a component attribute configuration list of a first component and a component attribute configuration list of a second component further includes:
Processing the first component code file and the second component code file to obtain component information of the first component and component information of the second component, and storing the component identification and the component information into a database in a key value pair form, wherein a data key is the component identification, and a data value is the component information;
and traversing each data key in the database in sequence, and analyzing the component information corresponding to the data key to obtain a component attribute configuration list corresponding to the component.
6. The method of claim 5, wherein the component information is JSON-formatted component information;
the analyzing the component information corresponding to the data key to obtain a component attribute configuration list corresponding to the component further comprises:
and extracting a component attribute configuration list corresponding to the component from the component information corresponding to the data key according to the preset keyword.
7. The method according to claim 5 or 6, wherein the processing the first component code file and the second component code file to obtain component information of a first component and component information of a second component further includes:
performing lexical analysis and grammar analysis on the first component code file and the second component code file to generate a first abstract syntax tree corresponding to the first component code file and a second abstract syntax tree corresponding to the second component code file;
Traversing the first abstract syntax tree to obtain the component information of the first component, and traversing the second abstract syntax tree to obtain the component information of the second component.
8. The method of any of claims 5-7, wherein the sequentially traversing each data key in the database further comprises:
judging whether all data keys in the database are processed completely;
if not, reading an unprocessed data key from the database.
9. The method of claim 8, wherein the sequentially traversing each component attribute in each component attribute configuration list further comprises:
judging whether all the component attributes in the component attribute configuration list are processed completely;
if not, reading an unprocessed component attribute from the component attribute configuration list;
if yes, judging whether all the data keys in the database are processed completely.
10. A component configuration generating apparatus that generates a first component code file and a second component code file in advance, wherein a target component attribute in the second component code file is written with a preset attribute annotation for indicating that an attribute value of the target component attribute is extended to use an attribute value of the first component, the apparatus comprising:
The processing module is suitable for processing the first component code file and the second component code file to obtain a component attribute configuration list of the first component and a component attribute configuration list of the second component;
the traversing module is suitable for traversing each component attribute in each component attribute configuration list in sequence;
and the replacing module is suitable for replacing the attribute value of the component attribute in the component attribute configuration list with the attribute value in the component attribute configuration list of the component used in the preset attribute annotation if the attribute annotation exists in the component attribute and the attribute annotation is the preset attribute annotation.
11. A computing device, comprising: the device comprises a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface complete communication with each other through the communication bus;
the memory is configured to store at least one executable instruction, where the executable instruction causes the processor to perform operations corresponding to the component configuration generating method according to any one of claims 1 to 9.
12. A computer storage medium having stored therein at least one executable instruction for causing a processor to perform operations corresponding to the component configuration generation method of any one of claims 1-9.
CN202311748951.2A 2023-12-18 2023-12-18 Component configuration generation method, device, computing equipment and computer storage medium Pending CN117724702A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311748951.2A CN117724702A (en) 2023-12-18 2023-12-18 Component configuration generation method, device, computing equipment and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311748951.2A CN117724702A (en) 2023-12-18 2023-12-18 Component configuration generation method, device, computing equipment and computer storage medium

Publications (1)

Publication Number Publication Date
CN117724702A true CN117724702A (en) 2024-03-19

Family

ID=90208564

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311748951.2A Pending CN117724702A (en) 2023-12-18 2023-12-18 Component configuration generation method, device, computing equipment and computer storage medium

Country Status (1)

Country Link
CN (1) CN117724702A (en)

Similar Documents

Publication Publication Date Title
CN110502227B (en) Code complement method and device, storage medium and electronic equipment
CN109343857B (en) Method, apparatus and storage medium for deploying machine learning model on line
WO2019075390A1 (en) Blackbox matching engine
US8954928B2 (en) Version labeling in a version control system
CN106657192B (en) Method and equipment for presenting service calling information
CN110502520B (en) Method, system and equipment for data warehousing and computer readable storage medium
CN113609820A (en) Method, device and equipment for generating word file based on extensible markup language file
CN110580189A (en) method and device for generating front-end page, computer equipment and storage medium
CN116841536A (en) Component reference relation reconstruction method, device, system and storage medium
CN112988163A (en) Intelligent programming language adaptation method and device, electronic equipment and medium
CN105824647A (en) Form page generating method and device
CN112860264B (en) Method and device for reconstructing abstract syntax tree
US20120310962A1 (en) Automated business process modeling
CN112541005A (en) Number generation method and device and electronic equipment
CN112631925B (en) Method for detecting single-variable atom violation defect
CN110489124B (en) Source code execution method, source code execution device, storage medium and computer equipment
CN117008920A (en) Engine system, request processing method and device, computer equipment and storage medium
CN113177391B (en) Method for redirecting operation cursor in streaming interface, computing equipment and storage medium
CN111061927A (en) Data processing method and device and electronic equipment
CN117724702A (en) Component configuration generation method, device, computing equipment and computer storage medium
CN109992293B (en) Method and device for assembling Android system component version information
JP2012173745A (en) Database analysis device and database analysis program
CN111273913A (en) Method and device for outputting application program interface data represented by specifications
CN113495753B (en) Method and device for acquiring label of item, electronic equipment and storage medium
CN112925564B (en) Method and device for cleaning redundant import class of source code

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination