Condition rendering method and system and electronic equipment

By encapsulating conditional rendering logic within components, using conditional parameters to select components for rendering, and implementing permission and volume verification within components, the problems of complex conditional rendering logic and lengthy code in front-end development are solved, and the flexibility and maintainability of the code are improved.

CN120610698APending Publication Date: 2025-09-09BEIJING BAILONG MAYUN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510531595.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-25
Publication Date
2025-09-09

AI Technical Summary

Technical Problem

In front-end development, conditional rendering logic is complex and the code is lengthy. In the face of ever-changing business needs, it is difficult to modify and expand, and the code is highly repetitive, which increases the development workload and the risk of errors.

Method used

Encapsulate conditional rendering in a component, receive and deconstruct the conditional parameters of the response object through business logic display components, use the Boolean value of the conditional parameters to select alternative components or sub-components for rendering, and implement permission and volume verification within the component, supporting multiple output modes and type verification to improve flexibility and simplicity.

Benefits of technology

It significantly improves the flexibility and simplicity of conditional rendering, reduces duplicate code, improves code scalability and readability, reduces development costs, and supports conditional rendering in different business scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120610698A_ABST
    Figure CN120610698A_ABST
Patent Text Reader

Abstract

The invention provides a condition rendering method, system and equipment, and relates to the technical field of computers, the method comprises the steps that a business logic display component receives and deconstructs a to-be-responded object to obtain Boolean values of condition parameters contained in the to-be-responded object, and the business logic display component is a pre-created component and comprises the condition parameters; the condition parameters are used for describing Boolean value types; if the Boolean value of the condition parameter is a first preset value, the business logic display component determines that the standby component is a target rendering component; if the Boolean value of the condition parameter is a second preset value, the business logic display component determines that the sub-component is a target rendering component; and the business logic display component performs rendering according to the content of the target rendering component. According to the method, the conditional rendering and the specific business logic are decoupled, the conditional rendering is packaged in the component, rendering of different components can be realized only by calling the conditional parameters, repeated compiling of the same logic is avoided, and flexibility and conciseness are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a conditional rendering method, system and electronic equipment. Background Art

[0002] With the continuous development of front-end development frameworks, in order to facilitate developers to build and maintain complex user interfaces, a component-based development model has begun to be used. Through componentization, the application is split into multiple functional units, so that each unit can be independently developed, tested and maintained.

[0003] Therefore, in the component-based development model, conditional rendering is an inevitable and frequently used requirement. Especially when facing ever-changing business needs, how to handle conditional rendering efficiently and concisely becomes an important challenge for developers. Summary of the Invention

[0004] In order to address the deficiencies of the prior art, the main purpose of the present invention is to provide a conditional rendering method, system and device to solve the above-mentioned technical problems of the prior art.

[0005] In order to achieve the above-mentioned object, the present invention provides a conditional rendering method in a first aspect, comprising:

[0006] The business logic display component receives and deconstructs the response object to obtain the Boolean value of the conditional parameter contained in the response object. The business logic display component is a pre-created component including the conditional parameter, a backup component, and a subcomponent. The conditional parameter is used to describe the Boolean value type.

[0007] If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines the backup component as the target rendering component;

[0008] If the Boolean value of the condition parameter is a second preset value, the business logic presentation component determines the subcomponent as the target rendering component;

[0009] The business logic display component renders according to the content of the target rendering component.

[0010] In some embodiments, the business logic display component further includes a permission parameter, which is used to describe the permission information object. Before rendering according to the content of the target rendering component, the business logic display component further includes:

[0011] The business logic display component responds to the permission parameter contained in the object to be responded to by deconstruction, and verifies the format of the permission parameter according to the preset first object data format;

[0012] In response to detecting that the permission parameter format is correct, the business logic presentation component calls the permission verification method and passes the permission parameter to the permission determination method to obtain the permission result;

[0013] The business logic display component determines the target rendering component based on the permission result and condition parameters.

[0014] In some embodiments, the business logic display component further includes a volume expansion parameter and a volume expansion judgment parameter. The volume expansion parameter is used to describe the volume expansion information object, and the volume expansion judgment parameter is used to describe the volume expansion execution function. Before the business logic display component renders according to the content of the target rendering component, it includes:

[0015] The business logic display component responds to the volume expansion parameter contained in the object to be responded to by deconstruction, and verifies the format of the volume expansion parameter according to the preset second object data format;

[0016] In response to detecting that the format of the volume-increasing parameter is correct, the business logic display component calls the volume-increasing verification method and passes the volume-increasing parameter to the volume-increasing verification method to obtain the volume-increasing user set;

[0017] The business logic display component passes the volume-increasing user set into the volume-increasing judgment parameter to obtain the volume-increasing result;

[0018] The business logic display component determines the target rendering component based on the volume expansion results and conditional parameters.

[0019] In some embodiments, the method further includes preloading of the permission verification method and / or the volume verification method:

[0020] Create an initialization function in the entry file of the application that contains the business logic presentation component;

[0021] Get and mount the permission verification method and / or volume verification method to the global object in the initialization function.

[0022] In some embodiments, after verifying the permission parameter format according to the preset first object data format, the method includes:

[0023] In response to detecting that the format of the volume parameter is incorrect, the business logic display component performs a safety downgrade and returns the target rendering component as empty;

[0024] After verifying the volume parameter format according to the preset second object data format, the method includes:

[0025] In response to detecting that the format of the volume parameter is incorrect, the business logic display component performs a safety downgrade and returns the target rendering component to be empty.

[0026] In some embodiments, the configuration of the business logic display component is also included:

[0027] Create business logic display components based on static module packaging tools, where static module packaging tools support multiple output modes;

[0028] Publish business logic display components through private repositories and declare entry files, type description files, and dependency description files.

[0029] In some embodiments, a method for performing security settings on a business logic presentation component includes:

[0030] Set the default value of the backup component to empty;

[0031] Based on the type description file, type verification is performed on the conditional parameters and / or business parameters in the business logic display component, where the business parameters include volume parameters, volume judgment parameters and / or permission parameters.

[0032] In some embodiments, the conditional parameter is a when parameter.

[0033] In a second aspect, the present application provides a conditional rendering system, the system comprising:

[0034] An analysis unit is used to trigger a business logic display component to receive and deconstruct a pending response object to obtain a Boolean value of a conditional parameter contained in the pending response object, wherein the business logic display component is a pre-created component including a conditional parameter, a backup component, and a subcomponent, and the conditional parameter is used to describe a Boolean value type;

[0035] The analyzing unit is further configured to trigger the business logic presentation component to determine the backup component as the target rendering component when the Boolean value of the conditional parameter is a first preset value;

[0036] The analysis unit is further configured to trigger the business logic presentation component to determine the subcomponent as the target rendering component when the Boolean value of the conditional parameter is a second preset value;

[0037] The rendering unit is used to render the business logic display component according to the content of the target rendering component.

[0038] The third aspect includes: a memory for storing a computer program; and a processor for implementing the steps of any one of the above-mentioned conditional rendering methods when executing the computer program.

[0039] In a fourth aspect, the present application provides a storage medium, wherein a computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of any of the above-mentioned conditional rendering methods are implemented.

[0040] The beneficial effects achieved by this application are:

[0041] The present application provides a conditional rendering method, including a business logic display component receiving and deconstructing a response object to obtain the Boolean value of a conditional parameter contained in the response object, wherein the business logic display component is a pre-created component, including a conditional parameter, a backup component and a sub-component, and the conditional parameter is used to describe the Boolean value type; if the Boolean value of the conditional parameter is a first preset value, the business logic display component determines the backup component as the target rendering component; if the Boolean value of the conditional parameter is a second preset value, the business logic display component determines the sub-component as the target rendering component; the business logic display component renders according to the content of the target rendering component. Decoupling conditional rendering from specific business logic and encapsulating conditional rendering in a component allows developers to render different components without having to design conditional rendering expressions. They only need to call the conditional parameters in the parameters passed into the component, avoiding rewriting the same logic in each place where it is used. This significantly improves the flexibility and simplicity of conditional rendering.

[0042] Not all products in this application need to have all the above effects. BRIEF DESCRIPTION OF THE DRAWINGS

[0043] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present application. Those skilled in the art can also derive other drawings based on these drawings without inventive work, among which:

[0044] Figure 1 This is a flow chart of the conditional rendering method provided by an embodiment of the present application;

[0045] Figure 2 This is a schematic diagram of a conditional rendering method in a permission control scenario provided by an embodiment of the present application;

[0046] Figure 3 This is a structural diagram of a conditional rendering system in a volume control scenario provided by an embodiment of the present application;

[0047] Figure 4 This is a structural diagram of a conditional rendering system provided by an embodiment of the present application;

[0048] Figure 5 This is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0049] To make the purpose, technical solutions, and advantages of this application more clear, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0050] It should be understood that in the description of this application, unless the context clearly requires otherwise, words such as "include", "comprises", and the like throughout the specification and claims should be interpreted as inclusive rather than exclusive or exhaustive; that is, as "including but not limited to".

[0051] It should also be understood that the terms "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying relative importance. In addition, in the description of this application, unless otherwise specified, the meaning of "plurality" is two or more.

[0052] It should be noted that the terms "S1", "S2", etc. are used only for the purpose of describing the steps and do not specifically refer to the order or sequence, nor are they used to limit this application. They are merely for the convenience of describing the method of this application and should not be understood as indicating the order of the steps. In addition, the technical solutions between the various embodiments can be combined with each other, but this must be based on the fact that ordinary technicians in this field can implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by this application.

[0053] As disclosed in the background technology, with the continuous development of front-end development frameworks, React (ReactComponent) components have become a mainstream front-end development framework. React components are JavaScript libraries used to build user interfaces. They are the basic construction units defined in the React framework. Each component can be regarded as an independent module responsible for implementing a part of the interface. Components can be class components or function components, and modularity and reusability are usually achieved by separating the UI and business logic. React uses componentization to split the application interface into multiple independent, reusable modules, making it easier for developers to build and maintain complex user interfaces; developers can split the application into multiple functional units, each of which can be independently developed, tested and maintained. In this development model, conditional rendering is an inevitable and frequently used requirement. Especially when facing ever-changing business needs, how to handle conditional rendering efficiently and concisely becomes an important challenge for developers.

[0054] In existing front-end development, traditional methods such as if statements, ternary operators, and logical AND operators are commonly used. These methods are simple and direct, quickly achieving basic rendering requirements. With technological advancements, conditional rendering solutions are also evolving. Techniques such as higher-order components and custom hooks can help developers better manage conditional rendering logic. However, when faced with complex business scenarios, existing conditional rendering methods suffer from code verbosity and increased complexity. Specifically, as the conditional rendering logic becomes more complex, the nesting of conditional statements complicates the code structure, hindering readability and comprehension. Furthermore, code repetition increases. If the same conditional rendering logic is used multiple times in different components or business scenarios, code duplication can occur, increasing development workload and the risk of errors. Furthermore, as business requirements change, developers may need to frequently modify the conditional rendering logic, making modification and expansion more difficult.

[0055] Therefore, the present application provides a method of encapsulating conditional rendering in a component, so that developers can achieve rendering of different components by simply calling the component and passing in parameters, thereby solving the above technical problems.

[0056] The embodiment of the present application discloses a conditional rendering method. To implement the conditional rendering method disclosed in the present application, the present application provides a business logic display component. Specifically, Figure 1 As shown, applying the conditional rendering method disclosed in this embodiment to render a webpage includes:

[0057] S1. The business logic display component receives and deconstructs the response object to obtain the Boolean value of the conditional parameter contained in the response object.

[0058] Among them, the business logic display component is a pre-created reusable component, including conditional parameters, backup components and sub-components. The conditional parameters are used to describe the Boolean value type and are the core judgment basis for conditional rendering. Preferably, the above-mentioned conditional parameters are set as When parameters. The backup component is a component used for error handling or loading status in React. In a specific implementation scenario, the backup component is the fallback component, and the sub-component is the children component. The business display component obtains each attribute in the object to be responded (props) passed into the component by deconstruction. In this embodiment, the object to be responded is the props passed into the component by the user, including at least the conditional parameters.

[0059] It is understandable that in order to improve the security of parameters, in a specific implementation scenario, this application also proposes: setting the default value of the backup component to empty. In addition, the conditional parameters in the business logic display component are type-checked based on the type description file. That is, secondly, TypeScript is used to perform strict type checking on the props of the component. Define a type alias for each parameter, clarify the data type, structure, and whether it is a required item for each parameter, capture potential type errors during the compilation phase, and reduce the occurrence of runtime exceptions. Furthermore, the backup component is optional, that is, when there is no backup component, the business logic display component only needs to be used to control whether the subcomponent is displayed or not.

[0060] Specifically, the configuration method of the business logic display component includes:

[0061] Create a business logic display component based on a static module packaging tool, where the static module packaging tool supports multiple output modes; the above-mentioned static module packaging tool is preferably set to a webpack tool. When publishing the business logic display component through a private repository, declare the entry file, type description file, and dependency description file. Specifically, after creating a new component project and initializing it, install the required dependencies. Then, when configuring webpack, configure webpack to support two output modes: UMD (Universal Module Definition) and ES (ECMAScript, a standardized script programming language). Then create and export the business logic display component, and further build the component library; then configure package.json and publish it to a private repository. When publishing through a private repository, it is necessary to specify the entry file, type description file, and dependency description file in package.json. Specifically, the entry file includes two types of files: main file and module file, where the main file points to the entry file in UMD format, and the module file points to the entry file in ES module format; preferably, the type description file is a types file, that is, it points to the type declaration file. The preferred dependency description file is a peerDependencies file, which is used to declare version requirements for core dependencies such as React. When introducing components, developers can choose the appropriate loading method according to the environment. Through the above configuration of components, it can be achieved that the business logic display components can run normally in different environments.

[0062] S2. If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines the backup component as the target rendering component.

[0063] Specifically, the business logic display component checks the Boolean value of the condition parameter. If the condition parameter is false, that is, the first preset value includes false, null, undefined or 0; that is, the condition is not met, the backup component is determined to be the target rendering component to be rendered.

[0064] S3. If the Boolean value of the conditional parameter is a second preset value, the business logic presentation component determines the subcomponent as the target rendering component.

[0065] Specifically, the business logic display component checks whether the Boolean value of the condition parameter is true (i.e., the second preset value), that is, the condition is met, and then determines that the subcomponent is the target rendering component to be rendered. It is understood that the subcomponent can be a JSX (JavaScript XML) element or a rendering function, which will not be expanded in this application.

[0066] S4. The business logic display component renders according to the content of the target rendering component.

[0067] Specifically, rendering is performed based on the content contained in the target rendering component, such as JSX elements or rendering functions.

[0068] In addition, in the method disclosed in this application, the business logic display component improves the reliability of rendering through a built-in multi-level quality assurance mechanism. Its design includes a triple protection system of TypeScript type verification at compile time, parameter checking at runtime, and react error boundaries; ensuring that the component can operate normally under various input conditions, omitting the need to set additional test-usable logic within the component.

[0069] This application decouples conditional rendering from specific business logic and encapsulates conditional rendering in components, so that developers do not need to design conditional rendering expressions. They only need to call the conditional parameters in the component input parameters to achieve the rendering of different components, avoiding the need to rewrite the same logic in every place where it is used. This significantly improves the flexibility and simplicity of conditional rendering, greatly improves the scalability and flexibility of the code, reduces repeated conditional judgment code, and reduces development costs. Developers can see a clear conditional rendering logic structure. If conditional rendering involves multiple states or complex logical judgments, the componentized approach can better organize the code.

[0070] The business logic display component disclosed in this application is very flexible in design and supports the input of extension components to expand component capabilities to support different business scenarios. In the specific permission control scenario disclosed in the embodiment of this application, Figure 2 As shown in the figure, by extending the permission parameters in the component, the component is expanded to achieve conditional rendering in the permission control scenario, including:

[0071] X1. The business logic display component responds to the permission parameters contained in the object to be responded to by deconstruction, and verifies the format of the permission parameters according to the preset first object data format.

[0072] At this time, the object to be responded to includes at least condition parameters and permission parameters. The permission parameter auth is an object data type, which is used to describe the permission information object and contains attributes that describe relevant permission information. Its first object data format is set to {fk:fkName, pk:pkName, type:typeName, name:name}, where fkName represents the unique key of the page type resource, pkName represents the unique key of the function type resource, typeName represents the extension field, and name represents the Chinese name of the function button. Specifically, the key attributes (fkName, pkName, typeName and name) in the permission parameter are verified to be complete through the first object data format; if complete, it is determined that the permission parameter format is correct; if incomplete, it is determined that the permission parameter format is incorrect.

[0073] X2. In response to detecting that the format of the permission parameter is correct, the business logic display component calls the permission verification method and passes the permission parameter to the permission judgment method to obtain the permission result.

[0074] Specifically, a global search is performed to determine whether a permission verification method exists. Specifically, the Window object can be accessed for the search, checking for a permission verification method, such as "window.BLMPermissionAut()." If a permission verification method exists, the permission parameters are passed into the permission verification method to obtain the permission result, including permission or no permission. In response to detecting a format error in the volume parameter, the business logic display component performs a security downgrade and returns the target rendering component as empty, that is, returns an empty node.

[0075] X3. The business logic display component determines the target rendering component based on the permission result and condition parameters and renders according to the content of the target rendering component.

[0076] Specifically, if the permission result is permission and the condition parameter is the second preset value (ie true), the subcomponent is determined as the target rendering component; if the permission result is no permission or the condition parameter is the first preset value, the backup component is determined as the target rendering component.

[0077] This application uses the above-mentioned business logic display component to encapsulate the resource permission judgment logic within the component for more efficient permission control. It adds permission parameters within the component and exposes them to developers to describe objects of permission information, thereby realizing the combination of permissions and conditions to render different content.

[0078] In the specific volume control scenario disclosed in the embodiments of this application, Figure 3 As shown in the figure, by further extending the permission parameters in the component, the component is expanded to achieve conditional rendering in the volume control scenario, including:

[0079] A1. The business logic display component responds to the volume expansion parameters contained in the object to be responded to by deconstruction, and verifies the format of the volume expansion parameters according to the preset second object data format.

[0080] Specifically, the volume expansion parameter cloundControlRelease is used to describe the volume expansion information object and is object type data. The corresponding second object data format is usually set to: {group:groupName,modules:[{moduleName:moduleName,configNames:configName s}]}; where group indicates that it belongs to a certain volume expansion group, moduleName indicates the module name, representing the module to which the volume expansion belongs, and configNames indicates the configuration name of the volume expansion. Specifically, the volume expansion parameter format is verified through the second object data format, that is, the key attributes (group, configNames, configNames) within the volume expansion parameter are verified through the second object data format. If they are complete, the volume expansion parameter format is determined to be correct; if they are incomplete, the volume expansion parameter format is determined to be incorrect.

[0081] A2. In response to detecting that the format of the volume-increasing parameter is correct, the business logic display component calls the volume-increasing verification method and passes the volume-increasing parameter to the volume-increasing verification method to obtain the volume-increasing user set.

[0082] The volume verification method is pre-installed on the Window object. You can search for it by accessing the Window object, such as "window.BLMCloudConfig()." After confirming the existence of the volume verification method, pass the volume parameters into the volume verification method to obtain the volume-enhancing user set. At this time, the volume-enhancing user set can be named a temporary variable loudConfigObj (indicating that the users in the list have access to new resources or new functions).

[0083] Of course, in response to detecting that the format of the volume parameter is incorrect, the business logic display component will perform security downgrade and return the target rendering component to be empty, consistent with the conditional rendering method in the permission control scenario.

[0084] A3. The business logic display component passes the volume-increasing user set into the volume-increasing judgment parameter to obtain the volume-increasing result.

[0085] The volume increase judgment parameter, cloudControlFunction, is a function type representing the execution function for determining volume increase. Its function determines whether the user is within the volume increase set. This can be customized by the developer, but the return value must be a Boolean value. Therefore, the volume increase user set is passed as a parameter to the volume increase judgment parameter to obtain the volume increase judgment result. A true result indicates that the user is within the volume increase user set; a false result indicates that the user is not within the volume increase user set.

[0086] A4. The business logic display component determines the target rendering component based on the volume expansion results and conditional parameters and renders according to the content of the target rendering component.

[0087] Specifically, if the scaling result is true and the conditional parameter is true, the subcomponent is determined to be the target rendering component; if the scaling result is false and / or the conditional parameter is false, the backup component is determined to be the target rendering component.

[0088] It is understandable that when technical service personnel delegate website resources or functions to users, they adopt a batch release method. This application encapsulates the release strategy within the component and exposes the release parameters, so that the business logic display component can render different content according to the release strategy and conditions. Of course, the extensible parameters in this application are not limited to the above-mentioned permission parameters and release parameters. Other parameters can also be defined according to the business scenario.

[0089] In the method disclosed in the embodiment of the present application, the high scalability of the component meets the conditional rendering in different business scenarios. When the business requirements change, the modification scope is only concentrated on the component itself, without the need to modify each specific component, which improves the readability and maintainability of the code and makes debugging and problem location more efficient.

[0090] In an embodiment of the present application, in order to ensure the normal operation of the permission function and the volume release function of the business logic display component, the loading of the permission verification method and the volume release verification method is completed in advance during the application startup phase, specifically including: creating an initialization function in the entry file (usually main.tsx or index.tsx) of the react application containing the business logic display component. This initialization function will be executed before the react application is mounted; obtaining and mounting the permission verification method and / or volume release verification method to the global object in the initialization function. That is, in the initialization function, the back-end interface or local configuration is called to obtain the permission verification method and the volume release verification method, and then the obtained permission verification method and the volume release verification method are mounted to the Window object for global access, where the permission verification method can be named: "window.BLMPermissionAut", and the volume release verification method can be named: "window.BLMCloudConfig". This application does not limit the specific naming method. After initialization is completed, the react application is rendered to ensure that the permission method of all components is available when rendering.

[0091] Example 2

[0092] Corresponding to the above embodiment, the present application provides a conditional rendering system, such as Figure 4 Shown, including:

[0093] An analysis unit 410 is configured to trigger a business logic display component to receive and deconstruct a pending response object to obtain a Boolean value of a conditional parameter contained in the pending response object, wherein the business logic display component is a pre-created component including a conditional parameter, a backup component, and a subcomponent, and the conditional parameter is used to describe a Boolean value type;

[0094] The analysis unit 410 is further configured to trigger the business logic presentation component to determine the backup component as the target rendering component when the Boolean value of the condition parameter is a first preset value;

[0095] The analysis unit 410 is further configured to trigger the business logic presentation component to determine the subcomponent as the target rendering component when the Boolean value of the conditional parameter is a second preset value;

[0096] The rendering unit 420 is used to render the business logic display component according to the content of the target rendering component.

[0097] Example 3

[0098] Corresponding to all the above embodiments, an embodiment of the present application provides an electronic device, including: one or more processors; and a memory associated with the one or more processors, the memory being used to store program instructions. When the program instructions are read and executed by the one or more processors, the program instructions perform the following operations:

[0099] The business logic display component receives and deconstructs the object to be responded to obtain a Boolean value of a condition parameter contained in the object to be responded to, wherein the business logic display component is a pre-created component including a condition parameter, a backup component, and a subcomponent, and the condition parameter is used to describe a Boolean value type;

[0100] If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines that the backup component is the target rendering component;

[0101] If the Boolean value of the conditional parameter is a second preset value, the business logic presentation component determines that the subcomponent is a target rendering component;

[0102] The business logic presentation component renders according to the content of the target rendering component.

[0103] in, Figure 5 The electronic device architecture is shown as an example, and may include a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, and a memory 520. The processor 510, the video display adapter 511, the disk drive 512, the input / output interface 513, the network interface 514, and the memory 520 may be communicatively connected via a bus 530.

[0104] Among them, the processor 510 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in this application.

[0105] The memory 520 can be implemented in the form of ROM (Read Only Memory, programmable memory), RAM (Random Access Memory, random access memory), static storage device, dynamic storage device, etc. The memory 520 can store an operating system 521 for controlling the execution of the electronic device 500, and a basic input and output system (BIOS) 522 for controlling the low-level operations of the electronic device 500. In addition, a web browser 523, a data storage management system 524, and an icon font processing system 525, etc. can also be stored. The above-mentioned icon font processing system 525 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided by the present application is implemented by software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.

[0106] The input / output interface 513 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components in the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.

[0107] The network interface 514 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WIFI, Bluetooth, etc.).

[0108] The bus 530 comprises a pathway for transmitting information between the various components of the device (eg, the processor 510 , the video display adapter 511 , the disk drive 512 , the input / output interface 513 , the network interface 514 , and the memory 520 ).

[0109] In addition, the electronic device 500 can also obtain information on specific collection conditions from the virtual resource object collection condition information database for use in condition judgment, etc.

[0110] It should be noted that although the above device only shows a processor 510, a video display adapter 511, a disk drive 512, an input / output interface 513, a network interface 514, a memory 520, a bus 530, etc., in a specific implementation, the device may also include other components necessary for normal execution. In addition, it will be understood by those skilled in the art that the above device may also include only the components necessary to implement the solution of the present application, and does not necessarily include all the components shown in the figure.

[0111] Example 4

[0112] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program is configured to execute the steps of any of the above-mentioned conditional rendering method embodiments when running:

[0113] The business logic display component receives and deconstructs the response object to obtain the Boolean value of the conditional parameter contained in the response object. The business logic display component is a pre-created component including the conditional parameter, a backup component, and a subcomponent. The conditional parameter is used to describe the Boolean value type.

[0114] If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines the backup component as the target rendering component;

[0115] If the Boolean value of the condition parameter is a second preset value, the business logic presentation component determines the subcomponent as the target rendering component;

[0116] The business logic display component renders according to the content of the target rendering component.

[0117] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.

[0118] Example 5

[0119] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above-mentioned conditional rendering method embodiments are implemented:

[0120] The business logic display component receives and deconstructs the response object to obtain the Boolean value of the conditional parameter contained in the response object. The business logic display component is a pre-created component including the conditional parameter, a backup component, and a subcomponent. The conditional parameter is used to describe the Boolean value type.

[0121] If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines the backup component as the target rendering component;

[0122] If the Boolean value of the condition parameter is a second preset value, the business logic presentation component determines the subcomponent as the target rendering component;

[0123] The business logic display component renders according to the content of the target rendering component.

[0124] Through the description of the above implementation methods, it can be seen that those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a cloud service terminal, or a network device, etc.) to execute the methods of each embodiment of the present application or certain parts of the embodiments.

[0125] Each embodiment in this specification is described in a progressive manner. The same or similar parts between the embodiments can be referred to each other. Each embodiment focuses on the differences from other embodiments. In particular, for system or system embodiments, since they are basically similar to method embodiments, the description is relatively simple. For relevant parts, refer to the partial description of the method embodiment. The system and system embodiments described above are merely schematic. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without making any creative efforts.

[0126] The above are only preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application should be included in the scope of protection of the present application.

Claims

1. A conditional rendering method, characterized in that: The method comprises: The business logic display component receives and deconstructs the object to be responded to obtain a Boolean value of a condition parameter contained in the object to be responded to, wherein the business logic display component is a pre-created component including a condition parameter, a backup component, and a subcomponent, and the condition parameter is used to describe a Boolean value type; If the Boolean value of the condition parameter is a first preset value, the business logic presentation component determines that the backup component is the target rendering component; If the Boolean value of the conditional parameter is a second preset value, the business logic presentation component determines that the subcomponent is a target rendering component; The business logic presentation component renders according to the content of the target rendering component.

2. The method according to claim 1, characterized in that The business logic display component further includes a permission parameter, which is used to describe a permission information object. Before the business logic display component renders according to the content of the target rendering component, the method further includes: The business logic presentation component verifies the format of the permission parameter according to a preset first object data format in response to the permission parameter contained in the object to be responded to obtained by deconstruction; In response to detecting that the format of the permission parameter is correct, the business logic presentation component calls the permission verification method and passes the permission parameter to the permission determination method to obtain a permission result; The business logic presentation component determines a target rendering component according to the permission result and the conditional parameters.

3. The method according to claim 2, characterized in that The business logic display component further includes a volume expansion parameter and a volume expansion judgment parameter. The volume expansion parameter is used to describe the volume expansion information object, and the volume expansion judgment parameter is used to describe the volume expansion execution function. Before the business logic display component renders according to the content of the target rendering component, the method includes: The business logic display component verifies the format of the volume parameter according to a preset second object data format in response to the volume parameter contained in the object to be responded to obtained by deconstruction; In response to detecting that the format of the volume-enhancing parameter is correct, the business logic display component calls the volume-enhancing verification method and passes the volume-enhancing parameter to the volume-enhancing verification method to obtain a volume-enhancing user set; The business logic display component passes the volume-enhancing user set into the volume-enhancing judgment parameter to obtain the volume-enhancing result; The business logic display component determines a target rendering component according to the volume expansion result and the conditional parameters.

4. The method according to claim 3, characterized in that The method further includes preloading the permission verification method and / or the volume verification method: Create an initialization function in the entry file of the application containing the business logic presentation component; Obtain and mount the permission verification method and / or the volume verification method to the global object in the initialization function.

5. The method according to claim 3, characterized in that After verifying the permission parameter format according to the preset first object data format, the method includes: In response to detecting that the scaling parameter format is incorrect, the business logic display component performs a safety downgrade and returns the target rendering component to be empty; After verifying the volume expansion parameter format according to the preset second object data format, the method includes: In response to detecting that the scaling parameter format is incorrect, the business logic presentation component performs a safety downgrade and returns the target rendering component to be empty.

6. The method according to claim 3, characterized in that The method also includes configuring the business logic presentation component: Creating business logic display components based on a static module packaging tool, where the static module packaging tool supports multiple output modes; Publish business logic display components through private repositories and declare entry files, type description files, and dependency description files.

7. The method according to claim 6, characterized in that The method performs security settings on the business logic presentation component, including: Set the default value of the backup component to empty; Based on the type description file, type verification is performed on the conditional parameters and / or business parameters in the business logic display component, wherein the business parameters include the volume expansion parameter, the volume expansion judgment parameter and / or the authority parameter.

8. The method according to claim 1, characterized in that The condition parameter is the when parameter.

9. A conditional rendering system, characterized in that: The conditional rendering system includes: an analysis unit, configured to trigger a business logic display component to receive and deconstruct a pending response object to obtain a Boolean value of a conditional parameter contained in the pending response object, wherein the business logic display component is a pre-created component including a conditional parameter, a backup component, and a subcomponent, and the conditional parameter is used to describe a Boolean value type; The analyzing unit is further configured to trigger the business logic presentation component to determine the backup component as the target rendering component when the Boolean value of the condition parameter is a first preset value; The analyzing unit is further configured to trigger the business logic presentation component to determine the subcomponent as a target rendering component when the Boolean value of the conditional parameter is a second preset value; A rendering unit is used for rendering the business logic presentation component according to the content of the target rendering component.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 8 are implemented.