CN108920496B - Rendering method and device - Google Patents

Rendering method and device Download PDF

Info

Publication number
CN108920496B
CN108920496B CN201810501059.7A CN201810501059A CN108920496B CN 108920496 B CN108920496 B CN 108920496B CN 201810501059 A CN201810501059 A CN 201810501059A CN 108920496 B CN108920496 B CN 108920496B
Authority
CN
China
Prior art keywords
target
parameter data
component
parameter
executable
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.)
Active
Application number
CN201810501059.7A
Other languages
Chinese (zh)
Other versions
CN108920496A (en
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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201810501059.7A priority Critical patent/CN108920496B/en
Publication of CN108920496A publication Critical patent/CN108920496A/en
Application granted granted Critical
Publication of CN108920496B publication Critical patent/CN108920496B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Devices For Executing Special Programs (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a rendering method and device, and belongs to the technical field of computers. Specifically, the method comprises the following steps: acquiring target parameter data corresponding to a target component from at least one preset first parameter data; generating an executable rendering logic based on the target parameter data, and compiling the target assembly to obtain an executable target assembly; when the executable target assembly is operated, rendering is carried out based on each parameter carried in the executable rendering logic, so that the assembly view displayed after rendering is determined by the parameter transmitted when the executable rendering logic is called because the rendering is carried out by operating the executable rendering logic, the assembly does not need to be re-developed, or the parameter is newly added in the target assembly and the logic module is correspondingly modified, the effect of upgrading the assembly function can be realized based on the executable rendering logic, the damage degree to the target assembly is reduced, and the assembly function upgrading maintenance cost is reduced.

Description

Rendering method and device
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a rendering method and device.
Background
With the continuous development of computer technology, the application of the terminal is more and more extensive, and a user can browse various pages by using the terminal. Generally, each displayed page is developed based on MVVM (Model-View Model) componentization, that is, each page is composed of a combination of MVVM components. The component generally includes a static template and a logic module, where the static template includes parameters determining a page display effect, such as color, position and size of each control, a component view changes after each event is triggered, and the like, the logic module generates rendering logic in combination with the static template, and when the component is run, each rendering logic in the logic module in the component renders based on the parameters included in the static template, and a page developed in a componentization manner can be obtained.
The static template and the logic module are often packaged together and have high coupling performance due to the characteristics of the components. Therefore, when the page needs to be optimized and the style of the page needs to be changed, the component corresponding to the page to be changed often needs to be redeveloped, or parameters need to be newly added in a static template in the original component corresponding to the page to be changed, and a corresponding logic module needs to be modified, so that the operation is complex, the damage degree to the original component is large, the logic complexity of the original component can be increased, and the maintenance cost in the later period is increased.
Disclosure of Invention
In view of the above, the present invention has been made to provide a rendering method and apparatus that overcome the above problems or at least partially solve the above problems.
According to a first aspect of the present invention, there is provided a rendering method, which may include:
acquiring first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data;
generating executable rendering logic based on the target parameter data, and compiling the target assembly to obtain an executable target assembly; wherein the executable rendering logic carries each parameter in the target parameter data;
and when the executable target component is operated, rendering is carried out based on each parameter carried in the executable rendering logic.
Optionally, the first parameter data is defined according to a page style and a structure, and each parameter carried in the first parameter data at least includes: the first component identifies the ID, the component properties, the tag, and the event.
Optionally, before the step of obtaining the first parameter data corresponding to the target component from the at least one preset first parameter data to obtain the target parameter data, the method further includes:
converting each second parameter data input by a user in advance into tree data to obtain a plurality of preset first parameter data;
taking the first component ID in each preset first parameter data as a key, taking each preset first parameter data as a value, and constructing a key value pair to obtain at least one key value pair;
the second parameter data is structured data generated based on a preset structured template, the first parameter data is tree-structured data, the first parameter data comprises a plurality of nodes, and a first component Identifier (ID), a component attribute, a tag and an event carried in the first parameter data are distributed on each node respectively.
Optionally, the step of obtaining first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data includes:
taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair;
and determining a first component ID matched with the second component ID as a target component ID, and determining first parameter data corresponding to the target component ID as target parameter data.
Optionally, the target component includes a verification ID;
the step of generating executable rendering logic based on the target parameter data comprises:
determining a verification rule corresponding to the verification ID in the target component as a target verification rule;
taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule;
if the parameter to be verified is matched with the target verification rule, a target compiler is called to compile target parameter data to obtain executable rendering logic;
wherein the target compiler is a compiler adapted to a syntax employed by the target parameter data.
Optionally, when the executable target component is executed, the step of performing rendering based on each parameter carried in the executable rendering logic includes:
deleting the original rendering logic in the logic module of the target assembly, and adding the executable rendering logic at the position of the original rendering logic;
and rendering is carried out based on the tags and the events carried in the executable rendering logic.
According to a second aspect of the present invention, there is provided a rendering apparatus, which may include:
the acquisition module is used for acquiring first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data;
the generating module is used for generating executable rendering logic based on the target parameter data and compiling the target assembly to obtain an executable target assembly; wherein the executable rendering logic carries each parameter in the target parameter data;
and the rendering module is used for rendering based on each parameter carried in the executable rendering logic when the executable target component is operated.
Optionally, the first parameter data is defined according to a page style and a structure, and each parameter carried in the first parameter data at least includes: the first component identifies the ID, the component properties, the tag, and the event.
Optionally, the apparatus further comprises:
the conversion module is used for converting each second parameter data input by a user in advance into tree data to obtain a plurality of preset first parameter data;
the building module is used for taking the first component ID in each preset first parameter data as a key, taking each preset first parameter data as a value, and building a key-value pair to obtain at least one key-value pair;
the second parameter data is structured data generated based on a preset structured template, the first parameter data is tree-structured data, the first parameter data comprises a plurality of nodes, and a first component Identifier (ID), a component attribute, a tag and an event carried in the first parameter data are distributed on each node respectively.
Optionally, the obtaining module is configured to:
taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair;
and determining a first component ID matched with the second component ID as a target component ID, and determining first parameter data corresponding to the target component ID as target parameter data.
Optionally, the target component includes a verification ID;
the generation module is configured to:
determining a verification rule corresponding to the verification ID in the target component as a target verification rule;
taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule;
if the parameter to be verified is matched with the target verification rule, a target compiler is called to compile target parameter data to obtain executable rendering logic;
wherein the target compiler is a compiler adapted to a syntax employed by the target parameter data.
Optionally, the rendering module is configured to:
deleting the original rendering logic in the logic module of the target assembly, and adding the executable rendering logic at the position of the original rendering logic;
and rendering is carried out based on the tags and the events carried in the executable rendering logic.
Aiming at the prior art, the invention has the following advantages:
the method can obtain first parameter data corresponding to a target assembly from at least one preset first parameter data to obtain target parameter data, then generate an executable rendering logic based on the target parameter data, compile the target assembly to obtain the executable target assembly, and finally, when the executable target assembly is operated, render based on each parameter carried in the executable rendering logic, so that when the executable rendering logic is used for rendering, a page effect displayed after rendering is determined by the parameters in the executable rendering logic, further, the assembly does not need to be re-developed, or the parameters are newly added in the target assembly, and a logic module is correspondingly modified, based on the executable rendering logic, the display effect can be changed, the operation process of changing the display effect is simplified, and meanwhile, the damage degree to the target assembly is reduced, the later maintenance cost is reduced.
The foregoing description is only an overview of the technical solutions of the present invention, and the embodiments of the present invention are described below in order to make the technical means of the present invention more clearly understood and to make the above and other objects, features, and advantages of the present invention more clearly understandable.
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 invention. Also, like reference numerals are used to refer to like parts throughout the drawings. In the drawings:
fig. 1 is a flowchart illustrating steps of a rendering method according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating steps of a rendering method according to a second embodiment of the present invention;
fig. 3 is a block diagram of a rendering apparatus according to a third embodiment of the present invention;
fig. 4 is a block diagram of a rendering apparatus according to a fourth embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can 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 invention to those skilled in the art.
Example one
Fig. 1 is a flowchart illustrating steps of a rendering method according to an embodiment of the present invention, as shown in fig. 1, the method may include:
step 101, obtaining first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data.
In the embodiment of the present invention, the target component may be a component corresponding to a target page, and the target page may be a page to be displayed. For example, assuming that page a needs to be displayed, the terminal may determine the component corresponding to page a as the target component. Further, the first parameter data may be defined according to a page style, and a developer may set corresponding first parameter data according to style change requirements of different pages to obtain a plurality of preset first parameter data. When the target component needs to be compiled, the first parameter data corresponding to the target component can be obtained from the plurality of first parameter data to obtain the target parameter data. For example, assuming that the background color of the page a needs to be changed to red, the developer may define a tag to be carried as "background color: red "first parameter data.
And 102, generating an executable rendering logic based on the target parameter data, and compiling the target assembly to obtain the executable target assembly.
In the embodiment of the present invention, when the terminal compiles the target component, the terminal may utilize a compiler matching the syntax used by the target component to compile the target component, so as to obtain an executable target component, which is exemplified by that for the case that an interpreted programming syntax is used: the target component of the python grammar may be compiled using a compiler (e.g., a vim compiler) that matches the python grammar. Further, when the terminal generates the executable rendering logic based on the target parameter data, in order to ensure that the target component can normally perform rendering based on the executable rendering logic in the subsequent process, the terminal may first verify each parameter in the target parameter data, and after the verification passes, generate the executable rendering logic based on the target parameter data. Specifically, during generation, since grammars used by different target parameter data may be different, when the terminal generates the executable rendering logic based on the target parameter data, a suitable compiler may also be selected according to the grammar used by the target parameter data, and then the target parameter data is compiled by using the compiler, so as to obtain the executable rendering logic, where each parameter in the target parameter data may be carried in the executable rendering logic. It should be noted that, during specific implementation of the terminal, the executable rendering logic may be generated based on the target parameter data, and then the target component is compiled, or the executable rendering logic may be generated based on the target component, and then the executable rendering logic is generated based on the target parameter data, of course, an operation of generating the executable rendering logic based on the target parameter data and an operation of compiling the target component may also be performed at the same time, which is not limited in the embodiment of the present invention.
And 103, when the executable target assembly is operated, rendering is carried out based on each parameter carried in the executable rendering logic.
In the embodiment of the present invention, when the terminal runs the executable target component, the rendering operation is completed based on each parameter carried in the executable rendering logic, so that the style of the displayed page is determined by each parameter carried in the executable rendering logic, that is, determined by the target parameter data. Thus, the style of the page is changed from the style determined by the parameters and logic defined in the original target component to the style determined by the target parameter data. Therefore, in the embodiment of the invention, the display effect can be changed through the preset target parameter data without redeveloping the component or newly adding parameters in the target component and correspondingly modifying the logic module, so that the operation process of changing the display effect is simplified, the damage degree to the target component is reduced, and the later maintenance cost is reduced.
To sum up, in the rendering method provided in the first embodiment of the present invention, first parameter data corresponding to a target component may be obtained from at least one preset first parameter data, so as to obtain target parameter data, then an executable rendering logic is generated based on the target parameter data, the target component is compiled, so as to obtain an executable target component, and finally, when the executable target component is executed, rendering is performed based on each parameter carried in the executable rendering logic, so that, when rendering is performed by using the executable rendering logic, a page effect displayed after rendering is determined by the parameter in the executable rendering logic, and therefore, it is not necessary to redevelop the component, or a parameter is newly added in the target component, and a logic module is correspondingly modified, and based on the executable rendering logic, a display effect can be changed, the operation process of changing the display effect is simplified, the damage degree to the target assembly is reduced, and the later maintenance cost is reduced.
Example two
Fig. 2 is a flowchart of steps of a rendering method according to a second embodiment of the present invention, and as shown in fig. 2, the method may include:
step 201, converting each second parameter data input by a user in advance into tree data to obtain a plurality of preset first parameter data.
In the embodiment of the present invention, since the hierarchical structure of the tree-structured data is more reasonable, and the terminal can generate an executable rendering logic based on the target parameter data conveniently, the terminal can set the format of the first parameter data to be the tree-structured data based on the Document Object Model (DOM). However, the difficulty in writing the first parameter data of the DOM tree structure is high, so in the embodiment of the present invention, a user may write the second parameter data in advance according to a page style requirement, and the terminal may convert the second parameter data into the data of the tree structure to obtain the first parameter data, thereby reducing the implementation difficulty.
Specifically, the second parameter data may be structured data generated based on a preset structured template, for example, the preset structured template may be:
<root id=″component1″>
<child rule-id=″rule1″attr=″attr″event=″event″></child>
</root>
wherein, root ID represents the ID set on the root node, child rule-ID represents the rule ID set on the child node, attr represents the attribute of the label, and event represents the event of label binding. When the user writes the second parameter data, the actual values of the items in the template can be set according to requirements. It should be noted that, in practical applications, the content of the preset structured template is not limited to that illustrated in the embodiment of the present invention, and may also be adjusted according to requirements, and the embodiment of the present invention does not limit this.
Step 202, taking the first component ID in each preset first parameter data as a key, taking each preset first parameter data as a value, and constructing a key-value pair to obtain at least one key-value pair.
In this step, the first parameter data may carry a first component identifier ID, a component attribute, a tag, and an event, where the tag may be one or more tags, and the event may also be one or more events. The first parameter data may include a plurality of nodes, and the first component ID, the component attribute, the tag, and the event carried in the first parameter data may be distributed on each node, respectively. Specifically, the first component ID may be distributed on the root node, and the component attributes, the respective tags, and the events may be distributed on the child nodes, respectively. It should be noted that, in practical applications, the component property and the event on the child node may be added according to the content in the component, and further, the event may be bound to the label. Further, the terminal may perform the following processing for each of the plurality of first parameter data: the terminal may use the first component ID in the first parameter data as a key, and then use the first parameter data as a value to form a key-value pair, thereby obtaining at least one key-value pair. In practical applications, to facilitate data management, the terminal may store the at least one key-value pair in the form of a mapping table, where each row in the mapping table may represent a key-value pair, and the first component ID in each first parameter data corresponds to the first parameter data.
Step 203, taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair.
In the embodiment of the present invention, the component ID in the component may be predefined by the user for each component, specifically, the component ID may be set according to the mode adopted by the framework of the component, for example, the class name of the component adopting the read framework may be used as the component ID, and the name attribute of the component adopting the VUE framework may be used as the component ID.
Further, when the user needs to change the page style of different pages and preset second parameter data for each page, the ID of the corresponding component can be added to the second parameter data for the ID of the component corresponding to the different pages, so that the converted second parameter data includes the component ID, and the terminal can distinguish the component ID from the component ID.
Accordingly, the terminal can search the first parameter data corresponding to the target component according to the component ID in the target component. For example, assume that there are three first parameter data: the first parameter data a, the first parameter data B and the first parameter data C, wherein the first component IDs in the three first parameter data are respectively: the first component ID "001", the first component ID "002", and the first component ID "003", the terminal may match the second component ID with the three first component IDs, respectively.
And 204, determining the first component ID matched with the second component ID as a target component ID, and determining the first parameter data corresponding to the target component ID as target parameter data.
For example, assuming that the second component ID is 002, the terminal may determine the first component ID "002" matching the second component ID as the target component ID and then determine the first parameter data B corresponding to the target component ID as the target parameter data.
Step 205, generating an executable rendering logic based on the target parameter data, and compiling the target component to obtain an executable target component.
In an actual application scenario, some components may have requirements on the types of data, and therefore, only when the types of target parameter data meet the requirements of target components, the executable rendering logic converted from the target parameter data can be used for rendering by the target components, and in the embodiment of the present invention, a developer may set a validation rule for each component in advance according to the condition of each component, for example, the validation rule may be written using languages such as Object Notation (JSON), Extensible Markup Language (XML), and the like. In the embodiment of the present invention, the executable rendering logic is executable agent rendering logic, and the executable target component is a target component capable of executing agent rendering.
Further, since some verification rules may be the same among the components, in the embodiment of the present invention, a developer may set a verification ID for each verification rule, and then add a corresponding verification ID to each component. In the embodiment of the invention, the verification link is increased by setting the verification ID, so that the data volume added in the component can be reduced. Of course, the validation rule may also be directly added to the component, which is not limited in the embodiment of the present invention.
Specifically, the terminal may determine a validation rule corresponding to the validation ID in the target component as the target validation rule; then taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule; and finally, if the parameter to be verified is matched with the target verification rule, calling a target compiler to compile the target parameter data to obtain executable rendering logic. It should be noted that, in practical applications, the first component ID may be set according to the verification ID, for example, the first component ID in the first parameter data corresponding to the target component may be set to be the same as the verification ID in the target component, and of course, the first component ID may also be set in other manners, which is not limited in this embodiment of the present invention.
For example, assuming that the parameters corresponding to the target verification rule are the tags, the tags in the target parameter data may be used as the parameters to be verified. Further, assuming that the target validation rule is a tag attribute of txt, and assuming that the attributes of each tag are txt, it may be determined that the parameter to be validated matches the target validation rule, at this time, the terminal may compile target parameter data using the target compiler, where the target compiler is a compiler adapted to the syntax used by the target parameter data,
in an actual application scenario, different target parameter data have different grammars, and compilers corresponding to different grammars also have different grammars. For example, the target parameter data in the React frame may generally adopt an XML syntax, and the target parameter data in the Vue frame may generally adopt a HyperText Markup Language (HTML) syntax, each having a corresponding compiler. In the embodiment of the invention, the compiler which is adaptive to the grammar adopted by the target parameter data is adopted for compiling, so that the terminal can be ensured to be capable of normally generating executable rendering logic based on the target parameter data. Further, the specific implementation process of compiling the target component by the terminal to obtain the executable target component may refer to the corresponding process in step 102, which is not described herein again in the embodiments of the present invention.
It should be noted that, in an actual application scenario, because the structure of the target parameter data is different from that of the target component by a relatively large amount, in another optional embodiment of the present invention, the verification ID may be set in the target parameter data, and the verification order of each verification ID may be defined, so that the problem of failure in verification due to verification of a non-corresponding parameter by using the target verification rule may be avoided.
And step 206, when the executable target component is operated, rendering is carried out based on each parameter carried in the executable rendering logic.
Specifically, the terminal may delete an original rendering logic in the logic module of the target component, and add an executable rendering logic at a position of the original rendering logic; specifically, the rendering logic of the component is generally a hook function as its declaration cycle, and accordingly, in the embodiment of the present invention, the executable rendering logic is also essentially a hook function, and this step may replace the existing hook function in the component with the new hook function when being implemented specifically. Then, the terminal may render based on the tag and the event carried in the executable rendering logic, for example, it is assumed that the tag 1, the tag 2 and the event 1 bound on the tag 2 are carried in the executable rendering logic, where the tag 1 is "background color: red, the tag 2 is a "button", and the event 1 is "when clicked, the picture a" is displayed, then after the terminal is rendered based on the tag and the event carried in the executable rendering logic, a page with a red background color and containing a button can be obtained, and when the button in the page is clicked, the picture a can be displayed.
In summary, in the rendering method provided by the second embodiment of the present invention, the terminal may convert each second parameter data input by the user in advance into the tree data to obtain the plurality of preset first parameter data, so that the user does not need to write the first parameter data by himself, and the implementation difficulty is reduced. Further, the terminal can obtain target parameter data from at least one preset first parameter data, then generate an executable rendering logic based on the target parameter data, and compile the target component to obtain an executable target component, and finally, when the executable target component is operated, render based on each parameter carried in the executable rendering logic, so that when the executable rendering logic is used for rendering, the page effect displayed after rendering is determined by the parameters in the executable rendering logic, further, the component does not need to be re-developed, or the parameters are newly added in the target component, and a logic module is correspondingly modified, the display effect can be changed based on the executable rendering logic, the operation process of changing the display effect is simplified, and meanwhile, the damage degree to the target component is reduced, the later maintenance cost is reduced.
EXAMPLE III
Fig. 3 is a block diagram of a rendering apparatus according to a third embodiment of the present invention, and as shown in fig. 3, the apparatus 30 may include:
an obtaining module 301, configured to obtain first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data;
a generating module 302, configured to generate an executable rendering logic based on the target parameter data, and compile the target component to obtain an executable target component; wherein the executable rendering logic carries each parameter in the target parameter data;
and the rendering module 303 is configured to perform rendering based on each parameter carried in the executable rendering logic when the executable target component is executed.
To sum up, in the rendering apparatus provided in the third embodiment of the present invention, the obtaining module may obtain, in at least one preset first parameter data, first parameter data corresponding to the target component to obtain target parameter data, the generating module may then generate an executable rendering logic based on the target parameter data, and compile the target component to obtain an executable target component, and finally, the rendering module may perform rendering based on each parameter carried in the executable rendering logic when the executable target component is executed, so that, when the executable rendering logic is used for rendering, a page effect displayed after rendering is determined by the parameter in the executable rendering logic, and therefore, it is not necessary to redevelop the component, or a parameter is newly added in the target component, and the logic module is correspondingly modified, so that a display effect can be changed based on the executable rendering logic, the operation process of changing the display effect is simplified, the damage degree to the target assembly is reduced, and the later maintenance cost is reduced.
Example four
Fig. 4 is a block diagram of a rendering apparatus according to a fourth embodiment of the present invention, and as shown in fig. 4, the apparatus 40 may include:
an obtaining module 401, configured to obtain first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data;
a generating module 402, configured to generate an executable rendering logic based on the target parameter data, and compile the target component to obtain an executable target component; wherein the executable rendering logic carries each parameter in the target parameter data;
and a rendering module 403, configured to perform rendering based on each parameter carried in the executable rendering logic when the executable target component is executed.
Optionally, the first parameter data is defined according to a page style and a structure, and each parameter carried in the first parameter data at least includes: the first component identifies the ID, the component properties, the tag, and the event.
Optionally, the apparatus 40 further includes:
a conversion module 404, configured to convert each second parameter data input by a user in advance into tree data, so as to obtain a plurality of preset first parameter data;
a building module 405, configured to take a first component ID in each preset first parameter data as a key, take each preset first parameter data as a value, and build a key-value pair to obtain at least one key-value pair;
the second parameter data is structured data generated based on a preset structured template, the first parameter data is tree-structured data, the first parameter data comprises a plurality of nodes, and a first component Identifier (ID), a component attribute, a tag and an event carried in the first parameter data are distributed on each node respectively.
Optionally, the obtaining module 401 is configured to:
taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair;
and determining a first component ID matched with the second component ID as a target component ID, and determining first parameter data corresponding to the target component ID as target parameter data.
Optionally, the target component includes a verification ID;
the generating module 402 is configured to:
determining a verification rule corresponding to the verification ID in the target component as a target verification rule;
taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule;
if the parameter to be verified is matched with the target verification rule, a target compiler is called to compile target parameter data to obtain executable rendering logic;
wherein the target compiler is a compiler adapted to a syntax employed by the target parameter data.
Optionally, the rendering module 403 is configured to:
deleting the original rendering logic in the logic module of the target assembly, and adding the executable rendering logic at the position of the original rendering logic;
and rendering is carried out based on the tags and the events carried in the executable rendering logic.
In summary, in the rendering apparatus provided in the fourth embodiment of the present invention, the conversion module may convert each second parameter data input by the user in advance into the tree data to obtain the plurality of preset first parameter data, so that the user does not need to write the first parameter data by himself, and the implementation difficulty is reduced. Further, the obtaining module may obtain target parameter data from at least one preset first parameter data, the generating module may then generate an executable rendering logic based on the target parameter data, and compile the target component to obtain an executable target component, and finally, the rendering module may render based on each parameter carried in the executable rendering logic when the executable target component is executed, so that, when the executable rendering logic is used for rendering, a page effect displayed after rendering is determined by the parameter in the executable rendering logic, and thus, it is not necessary to redevelop the component, or a parameter is newly added in the target component, and a logic module is modified accordingly, based on the executable rendering logic, a change of a display effect may be achieved, an operation process of changing the display effect is simplified, and a damage degree to the target component is reduced at the same time, the later maintenance cost is reduced.
For the above device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for the relevant points, refer to the partial description of the method embodiment.
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As is readily imaginable to the person skilled in the art: any combination of the above embodiments is possible, and thus any combination between the above embodiments is an embodiment of the present invention, but the present disclosure is not necessarily detailed herein for reasons of space.
The rendering methods provided 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 structure required to construct a system incorporating aspects of the present invention will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention 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 foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the invention and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed 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 invention.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. 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. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements 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 described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the claims, any of the claimed embodiments may be used in any combination.
The various component embodiments of the invention may be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It will be appreciated by those skilled in the art that a microprocessor or Digital Signal Processor (DSP) may be used in practice to implement some or all of the functionality of some or all of the components of the rendering method according to embodiments of the invention. The present invention may also be embodied as apparatus or device programs (e.g., computer programs and computer program products) for performing a portion or all of the methods described herein. Such programs implementing the present invention may be stored on computer-readable media or may be in the form of one or more signals. Such a signal may be downloaded from an internet website or provided on a carrier signal or in any other form.
It should be noted that the above-mentioned embodiments illustrate rather than limit the invention, 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 invention 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 usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.

Claims (12)

1. A rendering method is applied to a terminal, and the method comprises the following steps:
acquiring first parameter data corresponding to a target component from at least one preset first parameter data to obtain target parameter data;
compiling the target parameter data to obtain an executable rendering logic, and compiling the target component to obtain an executable target component; wherein the executable rendering logic carries each parameter in the target parameter data;
when the executable target component is executed, rendering is carried out based on each parameter carried in the executable rendering logic, and the steps comprise: deleting original rendering logic in a logic module of the target assembly, adding the executable rendering logic at the position of the original rendering logic, and rendering based on each parameter carried in the executable rendering logic, so that the style of a target page is changed into a style determined by each parameter in the target parameter data from the style determined by the parameter and the logic defined in the original target assembly, wherein the target page is a page corresponding to the target assembly.
2. The method according to claim 1, wherein the first parameter data is defined according to a page style and a structure, and each parameter carried in the first parameter data at least comprises: the first component identifies the ID, the component properties, the tag, and the event.
3. The method according to claim 2, wherein before the step of obtaining the target parameter data by obtaining the first parameter data corresponding to the target component from the at least one preset first parameter data, the method further comprises:
converting each second parameter data input by a user in advance into tree data to obtain a plurality of preset first parameter data;
taking the first component ID in each preset first parameter data as a key, taking each preset first parameter data as a value, and constructing a key value pair to obtain at least one key value pair;
the second parameter data is structured data generated based on a preset structured template, the first parameter data is tree-structured data, the first parameter data comprises a plurality of nodes, and a first component Identifier (ID), a component attribute, a tag and an event carried in the first parameter data are distributed on each node respectively.
4. The method according to claim 3, wherein the step of obtaining the first parameter data corresponding to the target component from the at least one preset first parameter data to obtain the target parameter data comprises:
taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair;
and determining a first component ID matched with the second component ID as a target component ID, and determining first parameter data corresponding to the target component ID as target parameter data.
5. The method of claim 1, wherein the target component includes a verification ID;
the step of generating executable rendering logic based on the target parameter data comprises:
determining a verification rule corresponding to the verification ID in the target component as a target verification rule;
taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule;
if the parameter to be verified is matched with the target verification rule, a target compiler is called to compile target parameter data to obtain executable rendering logic;
wherein the target compiler is a compiler adapted to a syntax employed by the target parameter data.
6. The method of claim 2, wherein the step of rendering based on the parameters carried in the executable rendering logic comprises:
and rendering is carried out based on the tags and the events carried in the executable rendering logic.
7. A rendering apparatus, applied to a terminal, the apparatus comprising:
the acquisition module is used for acquiring first parameter data corresponding to the target component from at least one preset first parameter data to obtain target parameter data;
the generation module is used for compiling the target parameter data to obtain an executable rendering logic and compiling the target component to obtain an executable target component; wherein the executable rendering logic carries each parameter in the target parameter data;
a rendering module, configured to perform rendering based on each parameter carried in the executable rendering logic when the executable target component is executed, including: deleting original rendering logic in a logic module of the target assembly, adding the executable rendering logic at the position of the original rendering logic, and rendering based on each parameter carried in the executable rendering logic, so that the style of a target page is changed into a style determined by each parameter in the target parameter data from the style determined by the parameter and the logic defined in the original target assembly, wherein the target page is a page corresponding to the target assembly.
8. The apparatus according to claim 7, wherein the first parameter data is defined according to a page style and a structure, and each parameter carried in the first parameter data at least comprises: the first component identifies the ID, the component properties, the tag, and the event.
9. The apparatus of claim 8, further comprising:
the conversion module is used for converting each second parameter data input by a user in advance into tree data to obtain a plurality of preset first parameter data;
the building module is used for taking the first component ID in each preset first parameter data as a key, taking each preset first parameter data as a value, and building a key-value pair to obtain at least one key-value pair;
the second parameter data is structured data generated based on a preset structured template, the first parameter data is tree-structured data, the first parameter data comprises a plurality of nodes, and a first component Identifier (ID), a component attribute, a tag and an event carried in the first parameter data are distributed on each node respectively.
10. The apparatus of claim 9, wherein the obtaining module is configured to:
taking the component ID of the target component as a second component ID, and matching the second component ID with each first component ID in the at least one key value pair;
and determining a first component ID matched with the second component ID as a target component ID, and determining first parameter data corresponding to the target component ID as target parameter data.
11. The apparatus of claim 7, wherein the target component includes a verification ID;
the generation module is configured to:
determining a verification rule corresponding to the verification ID in the target component as a target verification rule;
taking a parameter corresponding to the target verification rule in the target parameter data as a parameter to be verified, and judging whether the parameter to be verified is matched with the target verification rule;
if the parameter to be verified is matched with the target verification rule, a target compiler is called to compile target parameter data to obtain executable rendering logic;
wherein the target compiler is a compiler adapted to a syntax employed by the target parameter data.
12. The apparatus of claim 8, wherein the rendering module is configured to:
and rendering is carried out based on the tags and the events carried in the executable rendering logic.
CN201810501059.7A 2018-05-23 2018-05-23 Rendering method and device Active CN108920496B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810501059.7A CN108920496B (en) 2018-05-23 2018-05-23 Rendering method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810501059.7A CN108920496B (en) 2018-05-23 2018-05-23 Rendering method and device

Publications (2)

Publication Number Publication Date
CN108920496A CN108920496A (en) 2018-11-30
CN108920496B true CN108920496B (en) 2021-05-25

Family

ID=64402514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810501059.7A Active CN108920496B (en) 2018-05-23 2018-05-23 Rendering method and device

Country Status (1)

Country Link
CN (1) CN108920496B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110007906B (en) * 2018-12-27 2023-03-10 创新先进技术有限公司 Script file processing method and device and server
CN110780868A (en) * 2019-10-10 2020-02-11 北大方正集团有限公司 Website development method, device, equipment and storage medium based on componentized template
CN111079382A (en) * 2019-11-29 2020-04-28 苏宁云计算有限公司 Form rendering method and system based on MVVM (multifunction virtual machine) mode
CN112181424A (en) * 2020-02-27 2021-01-05 王建 Software development system, and compiling method and device of software development kit
CN111708592B (en) * 2020-05-27 2023-08-08 深圳市鸿合创新信息技术有限责任公司 Program component display method and device
CN112256994A (en) * 2020-10-20 2021-01-22 中企动力科技股份有限公司 Template rendering method and device, electronic equipment and storage medium
CN113378059A (en) * 2021-06-30 2021-09-10 北京字节跳动网络技术有限公司 Page display method and device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102646038A (en) * 2012-02-28 2012-08-22 广州市动景计算机科技有限公司 Control content display method, control content display device and mobile terminal
CN103235722A (en) * 2013-04-19 2013-08-07 南京莱斯信息技术股份有限公司 ActiveX control framework technology achieving method
US8522212B1 (en) * 2010-07-21 2013-08-27 Google Inc. Auto generation of test utility bots using compile time heuristics of user interface source code
CN105700925A (en) * 2016-01-13 2016-06-22 深圳市华讯方舟软件信息科技有限公司 APP interface implementation method and apparatus
CN107315599A (en) * 2016-04-27 2017-11-03 龙芯中科技术有限公司 Shape library extracting method and device
CN107506227A (en) * 2017-09-04 2017-12-22 郑州云海信息技术有限公司 The method and apparatus for managing compiled code

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150356065A1 (en) * 2014-06-09 2015-12-10 Microsoft Corporation Converting presentation metadata to a browser-renderable format during compilation

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8522212B1 (en) * 2010-07-21 2013-08-27 Google Inc. Auto generation of test utility bots using compile time heuristics of user interface source code
CN102646038A (en) * 2012-02-28 2012-08-22 广州市动景计算机科技有限公司 Control content display method, control content display device and mobile terminal
CN103235722A (en) * 2013-04-19 2013-08-07 南京莱斯信息技术股份有限公司 ActiveX control framework technology achieving method
CN105700925A (en) * 2016-01-13 2016-06-22 深圳市华讯方舟软件信息科技有限公司 APP interface implementation method and apparatus
CN107315599A (en) * 2016-04-27 2017-11-03 龙芯中科技术有限公司 Shape library extracting method and device
CN107506227A (en) * 2017-09-04 2017-12-22 郑州云海信息技术有限公司 The method and apparatus for managing compiled code

Also Published As

Publication number Publication date
CN108920496A (en) 2018-11-30

Similar Documents

Publication Publication Date Title
CN108920496B (en) Rendering method and device
US9411559B2 (en) Resolution of textual code in a graphical hierarchical model of a technical computing environment
US8856726B2 (en) Verification of computer-executable code generated from a slice of a model
US9418230B2 (en) Automated tools for building secure software programs
Voelter et al. mbeddr: Instantiating a language workbench in the embedded software domain
US9594802B2 (en) Graphical modeling of database query statements
US20160004516A1 (en) Code Generation Framework for Application Program Interface for Model
US9207935B2 (en) Early analysis of software design diagrams
US20140282379A1 (en) Computer-implemented method, system and computer program product for displaying a user interface component
US9471286B2 (en) System and method for providing code completion features for code modules
Groenewegen et al. Integration of data validation and user interface concerns in a DSL for web applications
JP2011060277A (en) Integration environment generator
Gargantini et al. A semantic framework for metamodel-based languages
Kozlowski et al. Mastering Web Application Development with AngularJS.
CN109408101A (en) A kind of code development maintaining method and electronic equipment for programming
Farahbod et al. The CoreASM modeling framework
Roldán React Design Patterns and Best Practices: Design, build and deploy production-ready web applications using standard industry practices
US20230195825A1 (en) Browser extension with automation testing support
Savic et al. Use case specification at different levels of abstraction
US20130111432A1 (en) Validation of a system model including an activity diagram
CN109542447B (en) OTX program file execution method and device
Pfeiffer et al. The design space of multi-language development environments
Prochnow et al. Synthesizing safe state machines from Esterel
CN116755669A (en) Low code development method and tool based on DSL language operation model
Gargantini et al. Integrating formal methods with model-driven engineering

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
GR01 Patent grant
GR01 Patent grant