Form generation method, device, electronic device and storage medium
By obtaining and parsing the configuration information of mixed component of form rendering, combining text components and target components, the timeliness of form rendering and complex logic support are achieved, solving the problems of poor timeliness of form rendering and complex logic in the existing technology.
Patent Information
- Application Number
- CN202111438070.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-30
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2041-11-30
AI Technical Summary
In the prior art, form rendering is of poor timeliness, unable to meet the needs of complex combination logic, and unable to meet the differentiated scenarios in actual production.
By obtaining the configuration information of the mixed components to be rendered, based on the combination of text components and target components, parsing template character information and component attribute information, rendering target forms, realizing the interweaving use of components and text, and supporting complex combination logic.
It improves the timeliness of form rendering, meets the needs of complex combination logic, and adapts to differentiated scenarios in actual production.
Smart Images

Figure CN114186544B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of Internet technology, and in particular to a form generation method, device, electronic device and storage medium. Background Art
[0002] In the Internet age, forms are a common means of collecting statistical information and have a wide range of application scenarios, such as questionnaire forms that mainly use options and event registration forms that collect user information.
[0003] Since the data structure of the form matches the JSON format data, in the related technology, the form is usually described in the JSON data format and rendered in the order of the data structure description. Among them, JSON is a lightweight data format. However, the timeliness of form rendering in the related technology is poor, and it can only achieve simple nesting between basic components (such as input boxes, drop-down selection boxes, etc.), which cannot meet more complex combination logic, and thus cannot meet the needs of various differentiated scenarios in actual production. Summary of the invention
[0004] The present disclosure provides a form generation method, device, electronic device and storage medium to at least solve the problem that the timeliness of form rendering in the related art is poor and cannot meet more complex combination logic. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a form generation method is provided, including:
[0006] In response to a form generation instruction of a target form corresponding to a target page, first configuration information of a mixed component to be rendered corresponding to the target form is obtained; the mixed component is composed of a first text component and a target component, the target component includes at least one basic component, the basic component represents a single non-text component, and the first text component is used to display a first text;
[0007] Based on the first configuration information, the hybrid component is rendered on the target page to obtain the target form.
[0008] In an exemplary implementation, rendering the hybrid component on the target page based on the first configuration information to obtain the target form includes:
[0009] Parsing the first configuration information to obtain template character information; the template character information includes identification information of the target component;
[0010] Based on the text rendering mode, the information in the template string except the identification information is rendered on the target page, and based on the identification information and the component attribute information in the first configuration information, the target component is rendered on the target page to obtain the target form; the information except the identification information includes the first text component.
[0011] In an exemplary implementation, rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information includes:
[0012] Parsing the identification information to obtain a first key value corresponding to each of the at least one basic components;
[0013] Acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value;
[0014] Rendering the at least one basic component on the target page according to the component description information.
[0015] In an exemplary embodiment, the target component is composed of a second text component and the at least one basic component, the second text component is used to display a second text, and the rendering of the target component on the target page based on the identification information and the component attribute information in the first configuration information includes:
[0016] Parsing the identification information to obtain a first key value corresponding to each of the at least one basic components;
[0017] Acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value;
[0018] The second text component is rendered on the target page based on a text rendering mode, and the at least one basic component is rendered on the target page based on the component description information.
[0019] In an exemplary implementation, parsing the identification information to obtain the first key value corresponding to each of the at least one basic components includes:
[0020] Get the preset regular expression;
[0021] Matching the identification information based on the preset regular expression to obtain a matching result;
[0022] The matching result is used as the first key value.
[0023] In an exemplary embodiment, the method further comprises:
[0024] In response to the form generation instruction, obtaining second configuration information corresponding to the basic component to be rendered;
[0025] Based on the first configuration information, the hybrid component is rendered on the target page, and based on the second configuration information, the basic component to be rendered is rendered on the target page to obtain the target form.
[0026] According to a second aspect of an embodiment of the present disclosure, a form rendering device is provided, including:
[0027] A first response module is configured to execute a form generation instruction in response to a target form corresponding to a target webpage, and obtain first configuration information of a mixed component to be rendered corresponding to the target form; the mixed component is composed of a first text component and a target component, the target component includes at least one basic component, the basic component represents a single non-text component, and the first text component is used to display a first text;
[0028] The first rendering module is configured to render the hybrid component on the target page based on the first configuration information to obtain the target form.
[0029] In an exemplary embodiment, the first rendering module includes:
[0030] The template character information determination submodule is configured to parse the first configuration information to obtain template character information; the template character information includes identification information of the target component;
[0031] The target form determination submodule is configured to execute a text-based rendering mode, render the information in the template string except the identification information on the target page, and render the target component on the target page based on the identification information and the component attribute information in the first configuration information to obtain the target form; the information except the identification information includes the first text component.
[0032] In an exemplary embodiment, the target form determination submodule includes:
[0033] A first parsing unit is configured to parse the identification information to obtain a first key value corresponding to each of the at least one basic components;
[0034] A first acquiring unit is configured to acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value;
[0035] The first rendering unit is configured to render the at least one basic component on the target page according to the component description information.
[0036] In an exemplary embodiment, the target component is composed of a second text component and the at least one basic component, the second text component is used to display a second text, and the target form determination submodule includes:
[0037] A second parsing unit is configured to parse the identification information to obtain a first key value corresponding to each of the at least one basic components;
[0038] A second acquiring unit is configured to acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value;
[0039] The second rendering unit is configured to render the second text component on the target page based on a text rendering mode, and render the at least one basic component on the target page based on the component description information.
[0040] In an exemplary embodiment, the first parsing unit and the second parsing unit include:
[0041] A regular expression acquisition subunit is configured to execute and acquire a preset regular expression;
[0042] A matching result determination subunit is configured to perform matching of the identification information based on the preset regular expression to obtain a matching result;
[0043] The first key value determining subunit is configured to execute the matching result as the first key value.
[0044] In an exemplary embodiment, the device further comprises:
[0045] A second response module is configured to execute in response to the form generation instruction and obtain second configuration information corresponding to the basic component to be rendered;
[0046] The second rendering module is configured to render the hybrid component on the target page based on the first configuration information, and render the basic component to be rendered on the target page based on the second configuration information to obtain the target form.
[0047] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0048] processor;
[0049] a memory for storing instructions executable by the processor;
[0050] The processor is configured to execute the instructions to implement the form generation method as described in any of the above embodiments.
[0051] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device executes the form generation method described in any of the above embodiments.
[0052] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the form generating method described in any of the above embodiments is implemented.
[0053] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0054] In the disclosed embodiment, in response to the form generation instruction of the target form corresponding to the target page, the first configuration information of the hybrid component to be rendered corresponding to the target form is obtained. The hybrid component to be rendered is composed of a first text component (the first text component is used to display the first text) and a target component. The hybrid component can be rendered on the target page according to the first configuration information, thereby obtaining the target form. Since the disclosed embodiment can directly render the hybrid component on the target page according to the first configuration information of the hybrid component to be rendered, the timeliness of the form rendering is improved; furthermore, since the hybrid component is composed of the first text component and the target component, the interspersed use of components and texts is realized, thereby meeting more complex combination logic, and further meeting the needs of various differentiated scenarios in actual production; in addition, since the form is rendered according to the first configuration information, different first configuration information can be configured according to actual needs, thereby rendering different forms, further meeting the needs of various differentiated scenarios in actual production.
[0055] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0057] Figure 1 The figure is an application environment diagram of a form generation method according to an exemplary embodiment.
[0058] Figure 2 The figure is a flowchart of a form generating method according to an exemplary embodiment.
[0059] Figure 3 is a schematic diagram showing configuration information of a hybrid component according to an exemplary embodiment.
[0060] Figure 4 It is a flowchart showing a method of rendering the hybrid component on the target page based on the first configuration information to obtain a target form according to an exemplary embodiment.
[0061] Figure 5 It is a flowchart showing a method of rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information according to an exemplary embodiment.
[0062] Figure 6 It is another flowchart of rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information according to an exemplary embodiment.
[0063] Figure 7 The figure is a flowchart of another form generating method according to an exemplary embodiment.
[0064] Figure 8 is a schematic diagram showing second configuration information according to an exemplary embodiment.
[0065] Fig. 9 The figure is a schematic diagram of a configuration file according to an exemplary embodiment.
[0066] Fig.10 A form model obtained by parsing a renderer is shown according to an exemplary embodiment.
[0067] Fig.11 is a schematic diagram of a second form according to an exemplary embodiment.
[0068] Fig.12 The present invention is a block diagram of a form rendering device according to an exemplary embodiment.
[0069] Fig.13 The invention is a block diagram of an electronic device for form rendering according to an exemplary embodiment. DETAILED DESCRIPTION
[0070] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0071] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0072] See also Figure 1 , Figure 1 01 is an application environment diagram of a form generation method according to an exemplary embodiment, and the application environment may include a client 01 and a server 02. The client 01 may be used to respond to a form generation instruction of a target form triggered based on a target page, obtain first configuration information corresponding to a hybrid component to be rendered; and render the hybrid component on the target page based on the first configuration information to obtain the target form. Optionally, the client 01 may include a terminal device such as a smart phone, a desktop computer, a tablet computer, a laptop computer, a digital assistant, an augmented reality (AR) / virtual reality (VR) device, a smart wearable device, etc.
[0073] The server 02 may be used to provide background services for the client 01. Optionally, the server 02 may be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0074] It should be noted that the above application environment is only an example, and the embodiments of the present disclosure may also include other application environments.
[0075] Figure 2 is a flow chart of a form generation method according to an exemplary embodiment. Figure 2 As shown, the form generation method is used to Figure 1 The client in , includes the following steps.
[0076] In step S11, in response to the form generation instruction of the target form corresponding to the target page, the first configuration information of the hybrid component to be rendered corresponding to the above target form is obtained; the above hybrid component is composed of a first text component and a target component, the above target component includes at least one basic component, the above basic component represents a single non-text component, and the above first text component is used to display the first text.
[0077] Optionally, the embodiment of the present disclosure may adopt a variety of methods to respond to the form generation instruction of the target form corresponding to the target page to obtain the above-mentioned first configuration information, and the embodiment of the present disclosure does not make specific limitations on this.
[0078] In one manner, the client may obtain the first configuration information in response to a form generation instruction of a target form triggered by a target page by a user.
[0079] In another manner, the client may also automatically and regularly trigger and respond to the form generation instruction to obtain the first configuration information.
[0080] Optionally, the target page may include, but is not limited to: a web page in a browser, a page in a short video, etc. Correspondingly, the form may be a web page form in a browser web page, a form in a short video page, etc.
[0081] Specifically, the basic component is a simple encapsulation of data and methods. In a web form, the display effect of the function of the element that needs to be displayed in the web form can be encapsulated in the form of data and methods to obtain the corresponding component. For example, in a web form, the display effect of the function of the element that needs to be displayed in the web form can be encapsulated in the form of data and methods to obtain the corresponding basic component. For example, a button is required in a web form, and the purpose of sending data to the target end can be achieved after clicking the button. In this case, the function and display effect of the button can be encapsulated in the form of data and methods to obtain the component corresponding to the send button. The function of the button includes but is not limited to the calling method of the send interface.
[0082] Exemplarily, the above basic components may include but are not limited to: an input box (Input), a drop-down selection box (Select), an image upload component (ImgUploader), etc. Specifically, the above basic components may be a basic unit of a form, which is a single non-text component.
[0083] It is understandable that the first text component is different from the basic component, and is a purely display component that represents the text type and is used to display the first text, that is, to display pure text, such as text in a chat box of an instant messaging software.
[0084] In the embodiment of the present disclosure, the combination of the first text component and the target component can be implemented in a variety of ways, which are not specifically limited in the embodiment of the present disclosure.
[0085] In one embodiment, the first text component and the target component may be sequentially arranged and combined in a preset order to obtain the mixed component, wherein the preset order may be the order in which the components need to be rendered.
[0086] Exemplarily, the mixed component may be a component formed by combining the first text component and a basic component. For example, the mixed component is formed by combining the first text component and a basic component in sequence.
[0087] Exemplarily, the mixed component may also be a component formed by combining the first text and at least two basic components. For example, the mixed component is formed by sequentially arranging and combining the basic component 1, the first text component, and the basic component 2.
[0088] Optionally, the first configuration information may be a display structure of interface elements such as text, graphics and images in a description form, and each text component and basic component has corresponding description information in the configuration information.
[0089] Figure 3 FIG. 1 is a schematic diagram showing configuration information of a hybrid component according to an exemplary embodiment. Figure 3 As shown, the hybrid component is composed of the first text component and the basic component. The configuration information includes component description information of the text component and each basic component, and the component description information may include but is not limited to: component, label, key, props, max, template.
[0090] Among them, component indicates the component type (component = ComplexComp is a mixed component); label indicates the business meaning of the component; key is the key value, which is the unique English character identifier of the component when the form containing the component is submitted; props indicates the unique properties of each component (such as Figure 3 As shown, the input box has a blank description); max represents the maximum value attribute; template represents a module string, which provides the ability to mix components.
[0091] In step S13, based on the first configuration information, the hybrid component is rendered on the target page to obtain the target form.
[0092] Optionally, the first configuration information may be parsed by a renderer to parse the hybrid component, and the hybrid component may be rendered on the page to obtain a target form.
[0093] In the disclosed embodiment, since the hybrid component can be rendered directly on the target page according to the first configuration information of the hybrid component to be rendered, the timeliness of the form rendering is improved; furthermore, since the hybrid component is composed of a first text component for displaying a first text and a target component, the interspersed use of components and texts is realized, thereby satisfying more complex combination logic, and further satisfying the needs of various differentiated scenarios in actual production; in addition, since the form is rendered according to the first configuration information, different first configuration information can be configured according to actual needs, thereby rendering different forms, further satisfying the needs of various differentiated scenarios in actual production.
[0094] Figure 4 FIG. 1 is a flowchart showing a method of rendering the hybrid component on the target page based on the first configuration information to obtain the target form according to an exemplary embodiment. Figure 4 As shown, in a feasible embodiment, in the above step S13, based on the above first configuration information, rendering the above hybrid component on the above target page to obtain the above target form may include:
[0095] In step S1301, the first configuration information is parsed to obtain template character information; the template character information includes identification information of the target component.
[0096] In step S1303, based on the text rendering mode, the information in the template string except the identification information is rendered on the target page, and based on the identification information and the component attribute information in the first configuration information, the target component is rendered on the target page to obtain the target form; the information except the identification information includes the first text component.
[0097] Optionally, when rendering components, the components can be rendered in sequence according to the order in which the components are combined in the mixed component. For example, if the mixed component is composed of the basic component 1, the first text component, and the basic component 2 in sequence, when rendering, the corresponding configuration information will be read in sequence for rendering.
[0098] Specifically, the first configuration information can be parsed to obtain template character information (for example, Figure 3 The template character information may include identification information of the target component and information other than the identification information of the target component.
[0099] Exemplarily, the identification information may include but is not limited to: ${xxx}, {{xxx}}, @{}, etc.
[0100] Exemplarily, the above information except the identification information of the target component is usually text information including the first text component.
[0101] Specifically, the above information except the identification information of the target component may be a non-matching part, and the non-matching part may be rendered as an ordinary text Text.
[0102] Exemplarily, the information in the template string except the identification information may be rendered based on a text rendering mode, and the text rendering mode may include but is not limited to: a compatible mode, a standard mode, an almost standard mode, and the like.
[0103] Specifically, the identification information of the target component may be a matching part. For the matching part, the target component may be rendered through the identification information and the component attribute information.
[0104] Exemplarily, the component attribute information may be Figure 3 The children attribute in is used to store all component information contained in the mixed component and is used when parsing template character information.
[0105] Next, continue with Figure 3 Take the above steps S1301 to S1303 as an example to illustrate:
[0106] In obtaining Figure 3 After the first configuration information is shown, the first configuration information can be parsed to find the template character information (ie Figure 3 The template in contains the identification information of the target component (i.e. Figure 3 ${subTitle} in ), and information other than the identification information (i.e. Figure 3 The title of submodule 1, the type of submodule 1, {type}).
[0107] For information other than the identification information (i.e., the non-matching part), it can be rendered on the target page according to the text rendering mode. For the identification information of the target component (i.e., the matching part), the target component can be rendered on the target page according to the identification information and the children attribute in the first configuration information, thereby obtaining the target form.
[0108] In the disclosed embodiment, during rendering, the template character information can be found and processed in two parts. For the information in the template string other than the identification information of the target component (i.e., the non-matching part), it can be rendered based on the text rendering mode. For the target component, it can be rendered based on the identification information of the target component and the component attribute information in the first configuration information, thereby obtaining the target form. By using different rendering methods for different parts, the efficiency and accuracy of form rendering can be improved, and the complexity of form rendering can be reduced, thereby meeting the needs of various differentiated scenarios in actual generation.
[0109] Figure 5 is a flowchart showing a method of rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information according to an exemplary embodiment. Figure 5 As shown, in an optional embodiment, in the above step S1303, rendering the above target component on the above target page based on the above identification information and the component attribute information in the above first configuration information may include:
[0110] In step S130311, the above identification information is parsed to obtain the first key value corresponding to each of the above at least one basic components.
[0111] In step S130313, the second key value corresponding to the first key value and the component description information corresponding to the second key value are obtained from the component attribute information.
[0112] In step S130315, according to the component description information, the at least one basic component is rendered on the target page.
[0113] Specifically, the identification information may include the first key value corresponding to at least one basic component. By parsing the identification information, the first key value corresponding to each component can be obtained. Among them, key is a symbol of identity identification. Each component has its own corresponding key. Through the key corresponding to each component, each component can be uniquely identified.
[0114] Optionally, since the component attribute information (i.e., the children attribute) is used to store all component information contained in the hybrid component, the second key value corresponding to the first key value can be obtained from the component attribute information. Each key value can be used to uniquely identify each component, so the corresponding component description information (including but not limited to: component, label, key, props, max, etc.) can be obtained through the first key value.
[0115] Optionally, the second key value may be the same as the first key value, or the second key value may match the first key value.
[0116] Specifically, the component description information can be parsed by a renderer, thereby rendering the at least one basic component on the target page. Figure 3 Taking the above steps S130311 to S130315 as an example, the following are explained:
[0117] Parse the identification information (i.e. Figure 3 ${subTitle} in the template), get the first key value as subTitle, then look for this subTitle (i.e. the second key value) from the children attribute, and look for the component description information corresponding to the subTitle (i.e.: component: Input, label: Template 1 Title, key: provinceCode), and then render the Input component according to the component description information.
[0118] It should be noted that although through analysis Figure 3 ${subTitle} in, confirm Figure 3 The target component in is the Input component (i.e., a basic component). However, in some feasible embodiments, the target component may include at least two basic components. Assuming that the number of the at least one basic component is 2 (basic component 1 and basic component 2), in step S130311, the first key value 1 corresponding to the basic component 1 and the first key value 2 corresponding to the basic component 2 can be parsed, and the second key value 1 corresponding to the first key value 1 and the component description information 1 corresponding to the second key value 1, the second key value 2 corresponding to the first key value 2 and the component description information 2 corresponding to the second key value 2 are obtained from the component description information. Finally, the basic component 1 is rendered on the target page based on the component description information 1, and the basic component 2 is rendered on the target page based on the component description information 2. The rendered basic component 1 and basic component 2 are the target components, that is, the target component is equivalent to a sub-hybrid component.
[0119] In the disclosed embodiment, since each component has a corresponding key value, by obtaining the second key value corresponding to the first key value from the component attribute information, the component corresponding to the second key value can be rendered quickly and accurately, thereby improving the accuracy and timeliness of component rendering, thereby meeting the needs of various differentiated scenarios in actual generation.
[0120] Figure 6 FIG. 1 is another flowchart showing another method of rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information according to an exemplary embodiment. Figure 6As shown, in another optional embodiment, the target component is composed based on the second text and the at least one basic component, and the second text component is used to display the second text. Then, in the step S1303, the step of rendering the target component on the target page based on the identification information and the component attribute information in the first configuration information may include:
[0121] In step S130331, the above identification information is parsed to obtain the first key value corresponding to each of the above at least one basic components.
[0122] In step S130333, the second key value corresponding to the first key value and the component description information corresponding to the second key value are obtained from the component attribute information.
[0123] In step S130335, the second text component is rendered on the target page based on the text rendering mode, and the at least one basic component is rendered on the target page based on the component description information.
[0124] In a feasible embodiment, in order to achieve infinite levels of nesting to generate infinite levels of forms, the target component can also be a sub-mixed component composed of a second text component and at least one basic component, that is, the target component can be a sub-mixed component composed of a text component and a basic component, and the target component can also be a sub-mixed component composed of a text component and at least two basic components.
[0125] In the case where the target component is composed of the second text component and at least one basic component, the corresponding component description information can be obtained according to the above steps S130331-S130333, and based on the component description information, the above at least one basic component is rendered on the target page. Among them, the above steps S130331-S130333, and the rendering of the above at least one basic component on the above target page based on the above component description information in step S130335 are similar to the above steps S130311-S130315, and will not be repeated here.
[0126] Since the target component is composed of the second text component and the at least one basic component, in addition to rendering the at least one basic component in the above manner, the second text component may also be rendered on the target page based on the text rendering mode.
[0127] Optionally, the second text component may be the same as the first text component or may be different from the first text component.
[0128] Continue to see Figure 3 ,like Figure 3If ${subTitle} in is a complex component (ComplexComp), then the ${subTitle} can be parsed to render the sub-complex component, thereby realizing the nesting of sub-complex components in complex components.
[0129] Exemplarily, in order to further realize the nesting of next level, the target component can also be composed of the second text and the first sub-mixed component, and the first sub-mixed component can be composed of at least one basic component, or can be composed of the text component and at least one basic component. In order to realize the nesting of next level again, the first sub-mixed component can also be composed of the text component and the second sub-mixed component, and the second sub-mixed component can be composed of at least one basic component, or can be composed of the text component and at least one basic component. By analogy, the hierarchy of the form can use the mixed component to infinitely expand downwards, realizes infinite levels of nesting sub-mixed components in the mixed component, thereby realizes infinite levels of nesting of the form. In another feasible embodiment, in order to further realize the nesting of infinite levels, to generate the form of infinite levels, the first text component can also be the mixed text component composed of multiple text components.
[0130] It should be noted that in actual scenarios, the logic and style need to be reasonably adjusted according to the actual rendering effect to achieve a usable state.
[0131] In the disclosed embodiment, when the target component is a sub-hybrid component composed of a second text component and at least one basic component, the component can be rendered based on the component description information corresponding to the component, and the second text component can be rendered based on the text rendering mode, thereby nesting the sub-hybrid component in the hybrid component, thereby realizing multi-level nesting of the form; and since each component has a corresponding key value, by obtaining the second key value corresponding to the first key value from the component attribute information, the component corresponding to the second key value can be rendered quickly and accurately, thereby improving the accuracy and timeliness of the component rendering; in addition, using different rendering methods for different parts can further improve the efficiency and accuracy of form rendering and reduce the complexity of rendering, thereby meeting the needs of various differentiated scenarios in actual generation.
[0132] In a feasible embodiment, in the above step S130311 and the above step S130331, the above parsing of the above identification information to obtain the first key value corresponding to each of the above at least one basic component may include:
[0133] Gets a preset regular expression.
[0134] The identification information is matched based on the preset regular expression to obtain a matching result.
[0135] The matching result is used as the first key value.
[0136] Specifically, the preset regular expression is a logic formula for operating a string (including common characters and special characters), that is, using some predefined specific characters and the combination of these specific characters to form a "regular string", which represents a filtering logic for the first key value.
[0137] Specifically, the process of matching the identification information based on the preset regular expression can be understood as filtering the identification information through the preset regular expression, obtaining a matching result that matches the preset regular expression, and using the matching result as the first key value. Since regular expressions are highly flexible, logical, and functional, obtaining the first key value through matching the preset regular expression can improve the efficiency and accuracy of determining the first key value, thereby improving the efficiency and accuracy of component rendering.
[0138] Figure 7 FIG. 1 is a flowchart of another form generation method according to an exemplary embodiment. Figure 7 As shown, in an optional embodiment, the above method may further include:
[0139] In step S21, in response to the above form generation instruction, second configuration information corresponding to the basic component to be rendered is obtained.
[0140] In step S23, based on the first configuration information, the hybrid component is rendered on the target page, and based on the second configuration information, the basic component to be rendered is rendered on the target page to obtain the target form.
[0141] Optionally, the second configuration information may be a display structure of interface elements such as text, graphics and images in a description form, and the basic components to be rendered all have corresponding description information in the configuration information.
[0142] Optionally, the basic components to be rendered may include but are not limited to: an input box (Input), a drop-down selection box (Select), an image upload component (ImgUploader), etc.
[0143] Specifically, in the above step S23, the process of rendering the above mixed component on the above target page based on the above first configuration information, and rendering the above basic component to be rendered on the above target page based on the above second configuration information is similar to the above steps S1301-S1303, and will not be repeated here.
[0144] Optionally, in the above step S23, a preset basic component library may be used to render the basic components to be rendered on the above target page.
[0145] Figure 8 FIG. 1 is a schematic diagram showing a second configuration information according to an exemplary embodiment. Figure 8 As shown, the second configuration information includes component description information of the basic component to be rendered, and the component description information may include but is not limited to: component, label, key, props, max, etc.
[0146] Fig. 9 FIG. 1 is a schematic diagram of a configuration file according to an exemplary embodiment. Fig. 9 As shown, the first configuration information and the second configuration information can be included in the same configuration file. The basic component to be rendered is the "Input" component, and the mixed component is a component composed of "text component + basic component".
[0147] Fig.10 A form model obtained by parsing a renderer is shown according to an exemplary embodiment. Fig.11 is a schematic diagram of a second form according to an exemplary embodiment. Fig. 9 The first configuration information and the second configuration information are parsed, and the parsed form model can be Fig.10 As shown, according to the form model, the second form finally rendered can be as follows Fig.11 shown.
[0148] In the disclosed embodiment, the second configuration information corresponding to the basic component to be rendered can be obtained in response to the above-mentioned form generation instruction, and the basic component to be rendered and the hybrid component can be cross-rendered on the target page. The logic and style of the component can be customized in the hybrid component, and multi-level nesting of the hybrid component can be performed, thereby achieving the rendering capability of infinite-level hybrid forms, meeting the various differentiated scenario requirements in actual production.
[0149] Fig.12 is a block diagram of a form rendering device according to an exemplary embodiment. Fig.12 , the device may include a first responding module 31 and a first rendering module 33.
[0150] The first response module 31 is configured to execute a form generation instruction in response to a target form corresponding to a target web page, and obtain first configuration information of a hybrid component to be rendered corresponding to the target form; the hybrid component is composed of a first text component and a target component, the target component includes at least one basic component, the basic component represents a single non-text component, and the first text component is used to display a first text.
[0151] The first rendering module 33 is configured to render the hybrid component on the target page based on the first configuration information to obtain the target form.
[0152] In an exemplary embodiment, the first rendering module 33 may include:
[0153] The template character information determination submodule is configured to parse the first configuration information to obtain template character information; the template character information includes identification information of the target component.
[0154] The target form determination submodule is configured to execute a text-based rendering mode, render the information in the template string other than the identification information on the target page, and render the target component on the target page based on the identification information and the component attribute information in the first configuration information to obtain the target form; the information other than the identification information includes the first text component.
[0155] In an exemplary embodiment, the target form determination submodule may include:
[0156] The first parsing unit is configured to parse the identification information to obtain a first key value corresponding to each of the at least one basic components.
[0157] The first acquisition unit is configured to acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value.
[0158] The first rendering unit is configured to render the at least one basic component on the target page according to the component description information.
[0159] In an exemplary embodiment, the target component is composed of a second text component and the at least one basic component, the second text component is used to display the second text, and the target form determination submodule may include:
[0160] The second parsing unit is configured to parse the identification information to obtain a first key value corresponding to each of the at least one basic components.
[0161] The second acquisition unit is configured to acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value.
[0162] The second rendering unit is configured to render the second text component on the target page based on the text rendering mode, and render the at least one basic component on the target page based on the component description information.
[0163] In an exemplary embodiment, the first parsing unit and the second parsing unit may include:
[0164] The regular expression acquisition subunit is configured to execute acquisition of a preset regular expression.
[0165] The matching result determination subunit is configured to match the identification information based on the preset regular expression to obtain a matching result.
[0166] The first key value determination subunit is configured to execute the matching result as the first key value.
[0167] In an exemplary embodiment, the above device may further include:
[0168] The second response module is configured to execute in response to the above-mentioned form generation instruction and obtain second configuration information corresponding to the basic component to be rendered.
[0169] The second rendering module is configured to render the hybrid component on the target page based on the first configuration information, and render the basic component to be rendered on the target page based on the second configuration information to obtain the target form.
[0170] Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0171] In an exemplary embodiment, an electronic device is also provided, including a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the steps of any form generation method in the above embodiments when executing the instructions stored in the memory.
[0172] The electronic device may be a terminal, a server or a similar computing device. For example, the electronic device is a server. Fig.13It is a block diagram of an electronic device for form rendering according to an exemplary embodiment. The electronic device 40 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 41 (the central processing unit 41 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 43 for storing data, and one or more storage media 42 (such as one or more mass storage devices) for storing application programs 423 or data 422. Among them, the memory 43 and the storage medium 42 can be short-term storage or permanent storage. The program stored in the storage medium 42 may include one or more modules, and each module may include a series of instruction operations in the electronic device. Furthermore, the central processing unit 41 can be configured to communicate with the storage medium 42 to execute a series of instruction operations in the storage medium 42 on the electronic device 40. The electronic device 40 may also include one or more power supplies 46, one or more wired or wireless network interfaces 45, one or more input and output interfaces 44, and / or one or more operating systems 421, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0173] The input / output interface 44 may be used to receive or send data via a network. The specific example of the network may include a wireless network provided by a communication provider of the electronic device 40. In one example, the input / output interface 44 includes a network adapter (Network Interface Controller, NIC), which may be connected to other network devices via a base station so as to communicate with the Internet. In an exemplary embodiment, the input / output interface 44 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0174] It can be understood by those skilled in the art that Fig.13 The structure shown is only for illustration and does not limit the structure of the above electronic device. Fig.13 More or fewer components as shown, or with Fig.13 Different configurations are shown.
[0175] In an exemplary embodiment, a computer-readable storage medium is further provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the steps of any form generating method in the above embodiments.
[0176] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, the form generating method provided in any one of the above-mentioned embodiments is implemented.
[0177] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided by the present disclosure can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0178] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0179] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A form generation method, characterized in that: include: In response to a form generation instruction of a target form corresponding to a target page, obtaining first configuration information of a hybrid component to be rendered corresponding to the target form; The mixed component is composed based on a first text component and a target component, the target component includes at least one basic component, the basic component represents a single non-text component, and the first text component is used to display a first text; Parsing the first configuration information to obtain template character information; the template character information includes identification information of the target component; Parsing the identification information to obtain a first key value corresponding to each of the at least one basic components; Acquire, from the component attribute information in the first configuration information, a second key value corresponding to the first key value and component description information corresponding to the second key value; Rendering the at least one basic component on the target page according to the component description information; Based on the text rendering mode, information other than the identification information in the template character information is rendered on the target page to obtain the target form; the information other than the identification information includes the first text component.
2. The form generation method according to claim 1, characterized in that: The target component is composed of a second text component and the at least one basic component, the second text component is used to display a second text, and the method further includes: The second text component is rendered on the target page based on a text rendering mode, and the at least one basic component is rendered on the target page based on the component description information.
3. The form generation method according to claim 1, characterized in that: The parsing the identification information to obtain the first key value corresponding to each of the at least one basic components includes: Get the preset regular expression; Matching the identification information based on the preset regular expression to obtain a matching result; The matching result is used as the first key value.
4. The form generation method according to claim 1, characterized in that: The method further comprises: In response to the form generation instruction, obtaining second configuration information corresponding to the basic component to be rendered; Based on the first configuration information, the hybrid component is rendered on the target page, and based on the second configuration information, the basic component to be rendered is rendered on the target page to obtain the target form.
5. A form generating device, characterized in that: include: A first response module is configured to execute a form generation instruction in response to a target form corresponding to a target webpage, and obtain first configuration information of a mixed component to be rendered corresponding to the target form; the mixed component is composed of a first text component and a target component, the target component includes at least one basic component, the basic component represents a single non-text component, and the first text component is used to display a first text; A first rendering module is configured to render the hybrid component on the target page based on the first configuration information to obtain the target form; The first rendering module includes: The template character information determination submodule is configured to parse the first configuration information to obtain template character information; the template character information includes identification information of the target component; A first parsing unit is configured to parse the identification information to obtain a first key value corresponding to each of the at least one basic components; A first acquiring unit is configured to acquire, from the component attribute information, a second key value corresponding to the first key value and component description information corresponding to the second key value; The first rendering unit is configured to render the at least one basic component on the target page according to the component description information; based on the text rendering mode, render the information in the template character information except the identification information on the target page to obtain the target form; the information except the identification information includes the first text component.
6. The form generating device according to claim 5, characterized in that: The first rendering module includes: The target form determination submodule is configured to execute a text-based rendering mode, render the information in the template string except the identification information on the target page, and obtain the target form; the information except the identification information includes the first text component.
7. The form generating device according to claim 5, characterized in that: The target component is composed of a second text component and the at least one basic component, the second text component is used to display a second text, and the device further includes: The second rendering unit is configured to render the second text component on the target page based on a text rendering mode, and render the at least one basic component on the target page based on the component description information.
8. The form generating device according to claim 5, characterized in that: The first parsing unit comprises: A regular expression acquisition subunit is configured to execute and acquire a preset regular expression; A matching result determination subunit is configured to perform matching of the identification information based on the preset regular expression to obtain a matching result; The first key value determining subunit is configured to execute the matching result as the first key value.
9. The form generating device according to claim 5, characterized in that: The device also includes: A second response module is configured to execute in response to the form generation instruction and obtain second configuration information corresponding to the basic component to be rendered; The second rendering module is configured to render the hybrid component on the target page based on the first configuration information, and render the basic component to be rendered on the target page based on the second configuration information to obtain the target form.
10. An electronic device, characterized in that: include: processor; A memory for storing the processor executable instructions; wherein the processor is configured to execute the instructions to implement the form generating method according to any one of claims 1 to 4.
11. A computer-readable storage medium, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device executes the form generating method according to any one of claims 1 to 4.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the form generating method according to any one of claims 1 to 4 is implemented.
