CN-122018907-A - List component generation method and device and related products
Abstract
The application discloses a method and a device for generating a list component and related products. Analyzing the component code template to obtain a component name configuration item, a component type configuration item and a component setting configuration item in a configuration item code sub-template in the component code template, analyzing a configuration item parameter set to obtain a target component name, a target component type and a target component setting in the configuration item parameter set, generating a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type and the target component setting, and generating a target component in a target list according to the component code file. Therefore, the method and the device can generate the target components in the target list according to the configuration item parameter set and the component code template, so that the generation of list components in different scenes can be satisfied, and the usability of the generated list components can be improved.
Inventors
- YI JIANGNAN
Assignees
- 腾讯科技(深圳)有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20241112
Claims (11)
- 1. A method for generating a list component, comprising: Acquiring a component code template and a configuration item parameter set input by a target object, wherein the component code template and the configuration item parameter set are used for supporting the generation of a list component; Analyzing the component code template to obtain a component name configuration item, a component type configuration item and a component setting configuration item in a configuration item code sub-template in the component code template; Analyzing the configuration item parameter set to obtain a target component name, a target component type and a target component setting in the configuration item parameter set; Generating a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type and the target component setting; And generating target components in a target list according to the component code file.
- 2. The method of claim 1, further comprising, prior to generating a component code file from the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type, and the target component setting: Acquiring a tool script, wherein the tool script is used for supporting the generation of a code file; Generating a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type and the target component setting, including: populating the target component name to the component name configuration item, and populating the target component type to the component type configuration item, and populating the target component setting to the component setting configuration item based on the tool script, generating an initial code file; And generating a component code file according to the initial code file.
- 3. The method of claim 2, further comprising, prior to said generating a component code file from said initial code file: Acquiring a code formatting tool, wherein the code formatting tool is used for executing formatting operation on the initial code file; The generating a component code file according to the initial code file comprises the following steps: and carrying out code formatting processing on the initial code file based on the code formatting tool to generate a component code file.
- 4. The method of claim 2, wherein the set of configuration item parameters further comprises a target component path, and wherein after the generating the target component in the target list from the component code file, further comprises: and generating a target component catalog according to the target component path and the target component name through the tool script, wherein the target component catalog is used for identifying the position of the target component in the target list.
- 5. The method of claim 4, further comprising, prior to the obtaining the component code template and the set of configuration item parameters entered by the target object: Obtaining a configuration item problem set, wherein the configuration item problem set comprises a first configuration item problem aiming at a component path, a second configuration item problem aiming at a component name, a third configuration item problem aiming at a component type and a fourth configuration item problem aiming at a component setting; Acquiring a configuration item parameter set input by a target object, comprising: receiving target component paths for the first configuration item question, target component names for the second configuration item question, target component types for the third configuration item question, and target component settings for the fourth configuration item question input by a target object; setting the target component path, the target component name, the target component type and the target component as a configuration item parameter set input by a target object.
- 6. The method of claim 1, wherein the component code template further comprises a style code sub-template, the generating a target component in a target list from the component code file comprising: generating the component code file based on the pattern code sub-template to obtain a target component containing a target pattern in a target list; and taking the target component containing the target style in the target list as the target component in the target list.
- 7. The method according to claim 6, further comprising, after said setting the target component in the target list that contains the target style as the target component in the target list: acquiring a style adjustment instruction submitted by the target object; performing template adjustment on the pattern code sub-template according to the pattern adjustment instruction to obtain an adjusted pattern code sub-template; and carrying out style adjustment on the target assembly containing the target style according to the adjusted style code sub-template to obtain an adjusted target assembly containing the target style.
- 8. A list component generating apparatus, comprising: the template parameter set acquisition unit is used for acquiring a component code template and a configuration item parameter set input by a target object, wherein the component code template and the configuration item parameter set are used for supporting the generation of a list component; The template analysis processing unit is used for analyzing the component code template to obtain a component name configuration item, a component type configuration item and a component setting configuration item in a configuration item code sub-template in the component code template; The parameter set analysis processing unit is used for analyzing the configuration item parameter set to obtain a target component name, a target component type and target component setting in the configuration item parameter set; A code file generating unit, configured to generate a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type, and the target component setting; And the target component generating unit is used for generating target components in a target list according to the component code file.
- 9. A computer device, the device comprising a processor and a memory: the memory is used for storing a computer program and transmitting the computer program to the processor; The processor is configured to perform the steps of the method of generating a list component according to any one of claims 1 to 7 according to instructions in the computer program.
- 10. A computer readable storage medium for storing a computer program which, when executed by a computer device, implements the steps of the method of generating a list component of any of claims 1 to 7.
- 11. A computer program product comprising a computer program which, when executed by a computer device, implements the steps of the method of generating a list component as claimed in any one of claims 1 to 7.
Description
List component generation method and device and related products Technical Field The present application relates to the field of component generation technologies, and in particular, to a method and apparatus for generating a list component, and a related product. Background The list component is the basis for constructing the list in the front page. In the related art, the generation of the list component is realized by adopting a mode of abstracting codes into common components, but the generation of the list component is realized by adopting a mode of abstracting codes into common components at the moment because different list components need to be generated, the usability of the generated list component may be not high. Thus, how to improve the usability of list component generation has become a technical problem to be solved in the current field. Disclosure of Invention The embodiment of the application provides a method and a device for generating a list component and related products, aiming at improving the generation availability of the list component. The first aspect of the present application provides a method for generating a list component, including: Acquiring a component code template and a configuration item parameter set input by a target object, wherein the component code template and the configuration item parameter set are used for supporting the generation of a list component; Analyzing the component code template to obtain a component name configuration item, a component type configuration item and a component setting configuration item in a configuration item code sub-template in the component code template; Analyzing the configuration item parameter set to obtain a target component name, a target component type and a target component setting in the configuration item parameter set; Generating a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type and the target component setting; And generating target components in a target list according to the component code file. The second aspect of the present application provides a device for generating a list component, including: the template parameter set acquisition unit is used for acquiring a component code template and a configuration item parameter set input by a target object, wherein the component code template and the configuration item parameter set are used for supporting the generation of a list component; The template analysis processing unit is used for analyzing the component code template to obtain a component name configuration item, a component type configuration item and a component setting configuration item in a configuration item code sub-template in the component code template; The parameter set analysis processing unit is used for analyzing the configuration item parameter set to obtain a target component name, a target component type and target component setting in the configuration item parameter set; A code file generating unit, configured to generate a component code file according to the component name configuration item, the component type configuration item, the component setting configuration item, the target component name, the target component type, and the target component setting; And the target component generating unit is used for generating target components in a target list according to the component code file. A third aspect of the application provides a computer apparatus comprising a processor and a memory: the memory is used for storing a computer program and transmitting the computer program to the processor; the processor is configured to perform the steps of the method for generating a list component provided in the first aspect according to instructions in the computer program. A fourth aspect of the present application provides a computer readable storage medium for storing a computer program which, when executed by a computer device, carries out the steps of the method of generating a list component provided in the first aspect. A fifth aspect of the application provides a computer program product comprising a computer program which, when executed by a computer device, carries out the steps of the method of generating a list component provided by the first aspect. From the above technical solutions, the embodiment of the present application has the following advantages: The technical scheme includes that a component code template and a configuration item parameter set input by a target object are firstly obtained, after that, the component code template is analyzed to obtain a component name configuration item, a component type configuration item and a component setting configuration item in the configuration item code sub-template in the component code template, the configuration item parameter set is analyzed to obtain a target component n