CN111427583A - Component compiling method and device, electronic equipment and computer readable storage medium - Google Patents

Component compiling method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN111427583A
CN111427583A CN202010282672.1A CN202010282672A CN111427583A CN 111427583 A CN111427583 A CN 111427583A CN 202010282672 A CN202010282672 A CN 202010282672A CN 111427583 A CN111427583 A CN 111427583A
Authority
CN
China
Prior art keywords
component
compiled
compiling
code
codes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010282672.1A
Other languages
Chinese (zh)
Inventor
史林
刘伟
谭旻
余锦
王宝仁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Citic Bank Corp Ltd
Original Assignee
China Citic Bank Corp 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 China Citic Bank Corp Ltd filed Critical China Citic Bank Corp Ltd
Priority to CN202010282672.1A priority Critical patent/CN111427583A/en
Publication of CN111427583A publication Critical patent/CN111427583A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Abstract

The embodiment of the application provides a compiling method and device of a component, an electronic device and a computer readable storage medium. The method comprises the following steps: when the code is compiled through the current compiling platform, determining a component to be compiled in the code; if the component to be compiled is a native component, compiling a code corresponding to the current compiling platform in the codes of the component to be compiled; and if the component to be compiled is a universal component, processing the code of the component to be compiled based on a preset rule, and compiling the processed code. Based on the scheme provided in the application, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.

Description

Component compiling method and device, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for compiling a component, an electronic device, and a computer-readable storage medium.
Background
Currently, with the rapid development of front-end technologies, more and more compiling platforms are provided by the front-end, such as desktop-end Web pages (Web), mobile-end Web pages (Web), applets, and Applications (APP). In the front-end development process, more business functions are developed in a componentization mode, and codes of all the business functions are packaged into components respectively.
In the prior art, components are developed independently aiming at functions of various compiling platforms, and the components between different compiling platforms cannot be adapted, so that in order to realize release of codes to various compiling platforms, the components need to be repeatedly developed for the various compiling platforms in the development process, which results in high development cost and low delivery efficiency of the codes.
Disclosure of Invention
The present application aims to solve at least one of the above technical drawbacks. The technical scheme adopted by the application is as follows:
in a first aspect, an embodiment of the present application provides a method for compiling a component, where the method includes:
when the code is compiled through the current compiling platform, determining a component to be compiled in the code;
if the component to be compiled is a native component, compiling a code corresponding to the current compiling platform in the codes of the component to be compiled;
and if the component to be compiled is a universal component, processing the code of the component to be compiled based on a preset rule, and compiling the processed code.
Optionally, compiling a code corresponding to the current compiling platform in the codes of the component to be compiled, where the compiling includes:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on the preset corresponding relationship between the type of the compiling platform and the codes of the components to be compiled;
and compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
Optionally, the generic components include UI components and non-presentation components.
Optionally, if the general component is a UI component, processing the code of the component to be compiled based on a preset rule, including:
replacing method names in the template codes with corresponding method names and replacing variable names in the template codes with corresponding variable names based on a preset first mapping relation aiming at the template codes in the assemblies to be compiled;
and replacing the lexical method in the grammar code with the corresponding lexical method and replacing the grammar in the grammar code with the corresponding grammar according to the grammar code in the component to be compiled based on the preset second mapping relation.
Optionally, if the general component is a non-display component, processing the code of the component to be compiled based on a preset rule, including:
and converting the interface parameters in the codes of the non-display components based on the interface parameter rules corresponding to the current compiling platform.
Optionally, the non-display assembly comprises:
a network communication component;
a data storage reading component; and the number of the first and second groups,
the device interface invokes the component.
In a second aspect, an embodiment of the present application provides a compiling apparatus for a component, where the apparatus includes:
the component determining module is used for determining a component to be compiled in the code when the code is compiled through the current compiling platform;
the first compiling module is used for compiling a code corresponding to the current compiling platform in the codes of the component to be compiled when the component to be compiled is a native component;
and the second compiling module is used for processing the code of the component to be compiled based on a preset rule and compiling the processed code when the component to be compiled is a general component.
Optionally, when compiling the code corresponding to the current compiling platform in the codes of the component to be compiled, the first compiling module is specifically configured to:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on the preset corresponding relationship between the type of the compiling platform and the codes of the components to be compiled;
and compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
Optionally, the generic components include UI components and non-presentation components.
Optionally, the second compiling module processes the code of the component to be compiled based on a preset rule, and is specifically configured to:
if the universal component is a UI component, replacing method names in the template codes with corresponding method names and replacing variable names in the template codes with corresponding variable names based on a preset first mapping relation aiming at the template codes in the components to be compiled; and replacing the lexical method in the grammar code with the corresponding lexical method and replacing the grammar in the grammar code with the corresponding grammar according to the grammar code in the component to be compiled based on the preset second mapping relation.
Optionally, the second compiling module processes the code of the component to be compiled based on a preset rule, and is specifically configured to:
and if the universal component is a non-display component, converting the interface parameters in the codes of the non-display component based on the interface parameter rule corresponding to the current compiling platform.
Optionally, the non-display assembly comprises:
a network communication component;
a data storage reading component; and the number of the first and second groups,
the device interface invokes the component.
In a third aspect, an embodiment of the present application provides an electronic device, including: a processor and a memory;
a memory for storing operating instructions;
a processor for executing a compilation method of components as shown in any of the embodiments of the first aspect of the present application by calling an operation instruction.
In a fourth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements a compiling method for components shown in any of the implementation manners of the first aspect of the present application.
The technical scheme provided by the embodiment of the application has the following beneficial effects:
according to the scheme provided by the embodiment of the application, when the codes are compiled, aiming at the native components in the components to be compiled, the component codes corresponding to the current compiling platform are selected from the codes for compiling; and processing the codes corresponding to the universal components aiming at the universal components in the components to be compiled, so that the codes corresponding to the universal components can run on the current compiling platform after being processed. Based on the scheme, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a flowchart illustrating a compiling method for a component according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a mobile UI component compiled by a VUE compiling into a WeChat applet UI component according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a process of compiling a mobile-side UI component written by a VUE into a desktop-side UI component according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a compiling apparatus for a component according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
As used herein, the singular forms "a", "an", "the" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may also be present. Further, "connected" or "coupled" as used herein may include wirelessly connected or wirelessly coupled. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 shows a flowchart of a compiling method for a component according to an embodiment of the present application, and as shown in fig. 1, the method mainly includes:
step S110, when the code is compiled through the current compiling platform, determining a component to be compiled in the code;
the set of cross-platform codes provided in the embodiment of the application can run in different compiling platforms such as desktop Web, mobile Web, applets and APPs.
In the embodiment of the application, when the code is compiled, the components to be compiled in the code can be determined, and each component to be compiled is processed, so that the components to be compiled can be compiled on the current compiling platform.
And step S120, if the component to be compiled is a native component, compiling a code corresponding to the current compiling platform in the codes of the component to be compiled.
The native component is a component developed and completed by using a specific platform technology framework and can only run in a specific platform.
In the embodiment of the application, when the native component in the code is developed, the component can be developed by using the native technical framework of each compiling platform, that is, the native component is developed for different compiling platforms respectively. The native components corresponding to each compilation platform follow the following principles: the business logic processed by the components should be kept consistent; the naming of the components should remain consistent; the exposed attribute and the event name of the component are consistent; and the data parameters and structure of the component when interacting with the outside should be kept consistent.
In the embodiment of the application, the code corresponding to the current compiling platform exists in the code, and the code corresponding to the current compiling platform can be conditionally compiled.
And S130, if the component to be compiled is a universal component, processing the code of the component to be compiled based on a preset rule, and compiling the processed code.
In the embodiment of the application, the general component is a component developed and completed through a certain technology stack, and the component which is constructed to run on different platforms can be compiled through a front-end engineering compiling technology.
In the embodiment of the application, when the universal component is compiled, the code of the component to be compiled can be processed based on a preset rule, so that the processed code of the component to be compiled can run on the current compiling platform.
According to the method provided by the embodiment of the application, when the codes are compiled, aiming at the native components in the components to be compiled, the component codes corresponding to the current compiling platform are selected from the codes for compiling; and processing the codes corresponding to the universal components aiming at the universal components in the components to be compiled, so that the codes corresponding to the universal components can run on the current compiling platform after being processed. Based on the scheme, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.
In an optional manner of the embodiment of the present application, compiling a code corresponding to a current compiling platform in codes of a component to be compiled includes:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on the preset corresponding relationship between the type of the compiling platform and the codes of the components to be compiled;
and compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
In the embodiment of the application, codes corresponding to native components and various compiling platforms exist in the codes, the corresponding relation between the type of the compiling platform and the native component codes can be preset, the codes corresponding to the current compiling platform are determined based on the corresponding relation and the type of the compiling platform of the current compiling platform, and the determined component codes corresponding to the current compiling platform are subjected to conditional compiling.
The generic components include a USER INTERFACE (UI) component and a non-presentation component.
In an optional manner of the embodiment of the present application, if the general component is a UI component, processing a code of the component to be compiled based on a preset rule includes:
replacing method names in the template codes with corresponding method names and replacing variable names in the template codes with corresponding variable names based on a preset first mapping relation aiming at the template codes in the assemblies to be compiled;
and replacing the lexical method in the grammar code with the corresponding lexical method and replacing the grammar in the grammar code with the corresponding grammar according to the grammar code in the component to be compiled based on the preset second mapping relation.
The UI component has corresponding technical frameworks for different compiling platforms, the technical frameworks are expanded or reduced based on three basic development languages, namely Hypertext Markup language (HTM L), Javascript and Cascading Style Sheets (CSS), and the development technical frameworks of different platforms have respective component development rules and certain isomorphism.
Because the technical frameworks have isomorphism, a certain technical framework can be used as a basic technical stack for developing components, and when the front-end compiling is carried out, the component codes compiled by the technical framework are converted into components which can be run by another technical framework by compiling a compiling script, so that the cross-platform use is realized.
Specifically, in component code conversion, conversion of method names in template codes and conversion of variable names are involved for template codes in components to be compiled. Therefore, the first mapping relationship may be preset, the method name in the code corresponding to each compiling platform is mapped, and the variable name in the code corresponding to each compiling platform is mapped.
And aiming at the grammar class codes in the component to be compiled, the lexical conversion in the template codes and the grammar conversion are involved. Therefore, the second mapping relationship may be preset, the lexical mapping in the code corresponding to each compiling platform may be established, and the grammar mapping in the code corresponding to each compiling platform may be established.
When the UI component in the component is compiled, the template class code and the grammar class code in the code corresponding to the UI component can be respectively replaced to obtain the code of the UI component which can be compiled on the current compiling platform.
As an example, the template transformation between the mobile Web end and the desktop Web end component mainly involves the adaptation from small screen to large screen, so that the property of component style class (class) needs to be replaced, and the level of the template Document Object Model (DOM) needs to be replaced.
As another example, template transformation of a mobile Web component with an applet component requires the replacement of template tags and template attributes, since the screen and client experience are consistent, but the tag grammars are different.
In actual use, the code structure of the component may be analyzed using an Abstract Syntax Tree (AST) tool.
As an example, a flow diagram of the compilation of a mobile-side UI component written by a VUE into a messenger UI component is shown in fig. 2.
As shown in FIG. 2, the VUE component is parsed to separate Template (Template) code, logical Script (Script) code, and Style code.
For the Template in the format of HTM L, AST may be used for analysis, and mapping and replacement may be performed on the Template labels, attributes, etc., and after the replacement, the Template in the format of micro beacon language (wei xin Markup L arrangement, WXM L) may be obtained, such as replacing < div > with < view >.
For logic Script in Javascript format, AST can be used for analysis, grammar and lexical substitution in logic can be performed, and logic Script in WeiXin Script (WXS) format can be obtained, such as replacing let x with var x.
For the Style in the CSS format, AST may be used for analysis, and grammars and lexical substitutions in the Style, such as 1px to 1.81 rpx. This results in a Style in WeiXin Style Sheets (WXSS) format.
And combining the replaced template, logic and style to obtain the WeChat applet component.
As an example, a flowchart for compiling a mobile-side UI component written by a VUE into a desktop-side UI component is shown in FIG. 3.
As shown in fig. 3, the mobile-end VUE component, i.e., the mobile-end UI component written by the VUE, parses the mobile-end VUE component at compile time, and separates Template (Template) code, logic Script (Script) code, and Style code.
For the Template in the format of HTM L, AST may be used for analysis, and Template attributes and Dom hierarchy may be replaced, for example, replacing < div class ═ mobile "> </div > with < div > < div class > </div >.
For logic Script in Javascript format, no replacement is needed because the syntax and logic are the same.
For the Style in CSS format, AST can be used for analysis, and logic in the Style is transformed for mobile and desktop-end features, such as replacing 1px by 10 px.
And combining the replaced template, the replaced style and the unprocessed logic to obtain the desktop end VUE assembly.
In an optional manner of the embodiment of the present application, if the general component is a non-display component, processing a code of the component to be compiled based on a preset rule includes:
and converting the interface parameters in the codes of the non-display components based on the interface parameter rules corresponding to the current compiling platform.
The non-illustrated components in the embodiments of the present application may be some components that operate on data or devices, such as components for network communication, data storage reading, device interface calling, and the like. In order to realize cross-platform operation, when a non-exposed component is developed, uniform method names, input parameters and output parameters need to be defined. And during compiling, converting according to interface parameter rules of different compiling platforms so that the interface parameters conform to the specifications of each compiling platform.
Taking the data request component as an example, a uniform data request method requestData can be defined during development. The method comprises the steps of completing a data request by using an AJAX technology in a Web end, completing the data request by using an equipment bridge interface in an APP, completing the data request by using a request interface of an applet platform in an applet, and converting input parameters and output parameters according to a data request rule, so that a data request technical component is realized, and developers can call requestData when using the method without concerning differences of a compiling platform.
In actual use, some business components may also exist in the code, and generally include multiple UI components or non-presentation components, and the UI components or the non-presentation components included in the code may be compiled based on the compiling method of the present application.
Based on the same principle as the method shown in fig. 1, fig. 4 shows a schematic structural diagram of a compiling apparatus of a component provided in an embodiment of the present application, and as shown in fig. 4, the compiling apparatus 20 may include:
the component determining module 210 is configured to determine a component to be compiled in a code when the code is compiled by a current compiling platform;
the first compiling module 220 is configured to compile a code corresponding to the current compiling platform in the codes of the component to be compiled when the component to be compiled is a native component;
the second compiling module 230 is configured to, when the component to be compiled is a general component, process a code of the component to be compiled based on a preset rule, and compile the processed code.
When the device provided by the embodiment of the application compiles the codes, the component codes corresponding to the current compiling platform are selected from the codes for compiling aiming at the native components in the components to be compiled; and processing the codes corresponding to the universal components aiming at the universal components in the components to be compiled, so that the codes corresponding to the universal components can run on the current compiling platform after being processed. Based on the scheme, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.
Optionally, when compiling the code corresponding to the current compiling platform in the codes of the component to be compiled, the first compiling module is specifically configured to:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on the preset corresponding relationship between the type of the compiling platform and the codes of the components to be compiled;
and compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
Optionally, the generic components include a user interface UI component and a non-presentation component.
Optionally, the second compiling module processes the code of the component to be compiled based on a preset rule, and is specifically configured to:
if the universal component is a UI component, replacing method names in the template codes with corresponding method names and replacing variable names in the template codes with corresponding variable names based on a preset first mapping relation aiming at the template codes in the components to be compiled; and replacing the lexical method in the grammar code with the corresponding lexical method and replacing the grammar in the grammar code with the corresponding grammar according to the grammar code in the component to be compiled based on the preset second mapping relation.
Optionally, the second compiling module processes the code of the component to be compiled based on a preset rule, and is specifically configured to:
and if the universal component is a non-display component, converting the interface parameters in the codes of the non-display component based on the interface parameter rule corresponding to the current compiling platform.
Optionally, the non-display assembly comprises:
a network communication component;
a data storage reading component; and the number of the first and second groups,
the device interface invokes the component.
It is to be understood that the above modules of the compiling apparatus of the components in the present embodiment have functions of realizing the corresponding steps of the compiling method of the components in the embodiment shown in fig. 1. The function can be realized by hardware, and can also be realized by executing corresponding software by hardware. The hardware or software includes one or more modules corresponding to the functions described above. The modules can be software and/or hardware, and each module can be implemented independently or by integrating a plurality of modules. For the functional description of each module of the compiling apparatus of the above-mentioned component, reference may be specifically made to the corresponding description of the compiling method of the component in the embodiment shown in fig. 1, and details are not described here again.
The embodiment of the application provides an electronic device, which comprises a processor and a memory;
a memory for storing operating instructions;
and the processor is used for executing the compiling method of the component provided by any embodiment of the application by calling the operation instruction.
As an example, fig. 5 shows a schematic structural diagram of an electronic device to which an embodiment of the present application is applicable, and as shown in fig. 5, the electronic device 2000 includes: a processor 2001 and a memory 2003. Wherein the processor 2001 is coupled to a memory 2003, such as via a bus 2002. Optionally, the electronic device 2000 may also include a transceiver 2004. It should be noted that the transceiver 2004 is not limited to one in practical applications, and the structure of the electronic device 2000 is not limited to the embodiment of the present application.
The processor 2001 is applied to the embodiment of the present application to implement the method shown in the above method embodiment. The transceiver 2004 may include a receiver and a transmitter, and the transceiver 2004 is applied to the embodiments of the present application to implement the functions of the electronic device of the embodiments of the present application to communicate with other devices when executed.
The Processor 2001 may be a CPU (Central Processing Unit), general Processor, DSP (Digital Signal Processor), ASIC (Application specific integrated Circuit), FPGA (Field Programmable Gate Array) or other Programmable logic device, transistor logic device, hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 2001 may also be a combination of computing functions, e.g., comprising one or more microprocessors, DSPs and microprocessors, and the like.
Bus 2002 may include a path that conveys information between the aforementioned components. The bus 2002 may be a PCI (Peripheral Component Interconnect) bus, an EISA (extended industry Standard Architecture) bus, or the like. The bus 2002 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.
The Memory 2003 may be a ROM (Read Only Memory) or other type of static storage device that can store static information and instructions, a RAM (Random Access Memory) or other type of dynamic storage device that can store information and instructions, an EEPROM (Electrically erasable programmable Read Only Memory), a CD-ROM (Compact disk Read Only Memory) or other optical disk storage, optical disk storage (including Compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer, but is not limited to these.
Optionally, the memory 2003 is used for storing application program code for performing the disclosed aspects, and is controlled in execution by the processor 2001. The processor 2001 is used to execute the application program code stored in the memory 2003 to implement the compilation method of components provided in any of the embodiments of the present application.
The electronic device provided by the embodiment of the application is applicable to any embodiment of the method, and is not described herein again.
Compared with the prior art, when compiling the codes, selecting the component codes corresponding to the current compiling platform in the codes for compiling aiming at the native components in the components to be compiled; and processing the codes corresponding to the universal components aiming at the universal components in the components to be compiled, so that the codes corresponding to the universal components can run on the current compiling platform after being processed. Based on the scheme, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.
The embodiment of the application provides a computer readable storage medium, which stores a computer program, and the program is executed by a processor to realize the compiling method of the components shown in the above method embodiment.
The computer-readable storage medium provided in the embodiments of the present application is applicable to any of the embodiments of the foregoing method, and is not described herein again.
Compared with the prior art, when compiling a code, selecting a component code corresponding to a current compiling platform in the code for compiling aiming at a native component in a component to be compiled; and processing the codes corresponding to the universal components aiming at the universal components in the components to be compiled, so that the codes corresponding to the universal components can run on the current compiling platform after being processed. Based on the scheme, the codes corresponding to the components to be compiled are processed in the compiling process, so that the codes can be compiled and run on different compiling platforms, a set of codes is provided to support the different compiling platforms, the development cost is reduced, and the delivery efficiency of the codes is improved.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The foregoing is only a partial embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A method for compiling a component, comprising:
when a code is compiled through a current compiling platform, determining a component to be compiled in the code;
if the component to be compiled is a native component, compiling a code corresponding to the current compiling platform in the codes of the component to be compiled;
and if the component to be compiled is a universal component, processing the code of the component to be compiled based on a preset rule, and compiling the processed code.
2. The method according to claim 1, wherein compiling the code corresponding to the current compiling platform in the code of the component to be compiled comprises:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on a preset corresponding relation between the type of the compiling platform and the codes of the components to be compiled;
compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
3. The method of claim 1, wherein the generic components include a User Interface (UI) component and a non-presentation component.
4. The method according to claim 3, wherein if the generic component is a UI component, the processing the code of the component to be compiled based on the preset rule includes:
replacing method names in the template codes with corresponding method names and replacing variable names in the template codes with corresponding variable names based on a preset first mapping relation aiming at the template codes in the assemblies to be compiled;
and replacing the lexical method in the grammar code with the corresponding lexical method and replacing the grammar in the grammar code with the corresponding grammar according to the grammar code in the component to be compiled based on a preset second mapping relation.
5. The method according to claim 3, wherein if the generic component is a non-display component, the processing the code of the component to be compiled based on a preset rule includes:
and converting the interface parameters in the codes of the non-display components based on the interface parameter rules corresponding to the current compiling platform.
6. The method of any one of claims 3-5, wherein the non-display assembly comprises:
a network communication component;
a data storage reading component; and the number of the first and second groups,
the device interface invokes the component.
7. An apparatus for compiling a component, comprising:
the component determination module is used for determining a component to be compiled in the code when the code is compiled through the current compiling platform;
the first compiling module is used for compiling a code corresponding to the current compiling platform in the codes of the component to be compiled when the component to be compiled is a native component;
and the second compiling module is used for processing the code of the component to be compiled based on a preset rule and compiling the processed code when the component to be compiled is a general component.
8. The apparatus according to claim 7, wherein the first compiling module, when compiling a code corresponding to the current compiling platform in the codes of the components to be compiled, is specifically configured to:
determining a code corresponding to the current compiling platform in the codes of the components to be compiled based on a preset corresponding relation between the type of the compiling platform and the codes of the components to be compiled;
compiling the codes corresponding to the current compiling platform in the codes of the components to be compiled.
9. An electronic device comprising a processor and a memory;
the memory is used for storing operation instructions;
the processor is used for executing the method of any one of claims 1-6 by calling the operation instruction.
10. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method of any one of claims 1-6.
CN202010282672.1A 2020-04-12 2020-04-12 Component compiling method and device, electronic equipment and computer readable storage medium Pending CN111427583A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010282672.1A CN111427583A (en) 2020-04-12 2020-04-12 Component compiling method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010282672.1A CN111427583A (en) 2020-04-12 2020-04-12 Component compiling method and device, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN111427583A true CN111427583A (en) 2020-07-17

Family

ID=71551849

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010282672.1A Pending CN111427583A (en) 2020-04-12 2020-04-12 Component compiling method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN111427583A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711400A (en) * 2020-12-31 2021-04-27 北京字跳网络技术有限公司 View processing method, device, storage medium and computer program product
CN113031932A (en) * 2021-03-11 2021-06-25 腾讯科技(深圳)有限公司 Project development method and device, electronic equipment and storage medium
CN113126997A (en) * 2021-04-21 2021-07-16 多点(深圳)数字科技有限公司 Compiling method for generating multiple operation containers by front-end code
CN113407255A (en) * 2021-06-16 2021-09-17 上海微盟企业发展有限公司 Component calling method and device and computer readable storage medium
CN113672224A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Method and device for generating small program page code and computer equipment
CN115857900A (en) * 2023-01-13 2023-03-28 安世亚太科技股份有限公司 Code automatic generation method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893014A (en) * 2015-12-08 2016-08-24 乐视云计算有限公司 Project development method and system for front end
US20180164966A1 (en) * 2016-12-14 2018-06-14 International Business Machines Corporation Providing user interface language options
CN109857403A (en) * 2018-12-05 2019-06-07 腾讯科技(深圳)有限公司 A kind of renewal of the page, page processing method and device
CN110489088A (en) * 2019-08-13 2019-11-22 绿漫科技有限公司 A kind of cross-platform small routine development approach
CN110780853A (en) * 2019-09-28 2020-02-11 同程网络科技股份有限公司 Front end framework, development method, storage medium and electronic device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893014A (en) * 2015-12-08 2016-08-24 乐视云计算有限公司 Project development method and system for front end
US20180164966A1 (en) * 2016-12-14 2018-06-14 International Business Machines Corporation Providing user interface language options
CN109857403A (en) * 2018-12-05 2019-06-07 腾讯科技(深圳)有限公司 A kind of renewal of the page, page processing method and device
CN110489088A (en) * 2019-08-13 2019-11-22 绿漫科技有限公司 A kind of cross-platform small routine development approach
CN110780853A (en) * 2019-09-28 2020-02-11 同程网络科技股份有限公司 Front end framework, development method, storage medium and electronic device

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711400A (en) * 2020-12-31 2021-04-27 北京字跳网络技术有限公司 View processing method, device, storage medium and computer program product
CN113031932A (en) * 2021-03-11 2021-06-25 腾讯科技(深圳)有限公司 Project development method and device, electronic equipment and storage medium
CN113031932B (en) * 2021-03-11 2023-10-20 腾讯科技(深圳)有限公司 Project development method, apparatus, electronic device and storage medium
CN113126997A (en) * 2021-04-21 2021-07-16 多点(深圳)数字科技有限公司 Compiling method for generating multiple operation containers by front-end code
CN113407255A (en) * 2021-06-16 2021-09-17 上海微盟企业发展有限公司 Component calling method and device and computer readable storage medium
CN113672224A (en) * 2021-08-20 2021-11-19 上海哔哩哔哩科技有限公司 Method and device for generating small program page code and computer equipment
CN115857900A (en) * 2023-01-13 2023-03-28 安世亚太科技股份有限公司 Code automatic generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111427583A (en) Component compiling method and device, electronic equipment and computer readable storage medium
CN110780853A (en) Front end framework, development method, storage medium and electronic device
CN106293675B (en) System static resource loading method and device
CN110502520B (en) Method, system and equipment for data warehousing and computer readable storage medium
CN110262783B (en) Interface generation method and device and terminal equipment
CN109710260B (en) Multi-platform-based applet code conversion method
CN108255837B (en) SQL parser and method
CN113031932B (en) Project development method, apparatus, electronic device and storage medium
CN110109671B (en) Webpack label size and style conversion method and device
CN112114818A (en) JAVA compiling method and device for expression
EP3974964A1 (en) Automated generation of software patches
CN111596970B (en) Method, device, equipment and storage medium for dynamic library delay loading
CN116755669A (en) Low code development method and tool based on DSL language operation model
CN111158665A (en) Code generation method and device, electronic equipment and storage medium
CN110058849A (en) Generation method, device, computer equipment and the storage medium of flow chart
CN113821195B (en) Method, device and equipment for generating executable program of target language
CN110737431B (en) Software development method, development platform, terminal device and storage medium
CN111399842B (en) Code compiling method and device
CN112328241B (en) Method and device for creating Android library module dependency relationship in application program development
CN110489124B (en) Source code execution method, source code execution device, storage medium and computer equipment
CN113961238A (en) Object conversion method and device, electronic equipment and storage medium
US9304743B1 (en) Converting from incorrect program code to correct program code
CN112905271A (en) Calling method and device of application program interface API and electronic equipment
CN112596737A (en) Method, system, equipment and storage medium for scanning function call relation
CN117075912B (en) Method for program language conversion, compiling method and related equipment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200717