CN114064006A - Code block insertion method and device, electronic equipment and storage medium - Google Patents

Code block insertion method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN114064006A
CN114064006A CN202111367541.4A CN202111367541A CN114064006A CN 114064006 A CN114064006 A CN 114064006A CN 202111367541 A CN202111367541 A CN 202111367541A CN 114064006 A CN114064006 A CN 114064006A
Authority
CN
China
Prior art keywords
code block
target
user
attribute data
target code
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
CN202111367541.4A
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.)
Beijing Minglue Zhaohui Technology Co Ltd
Original Assignee
Beijing Minglue Zhaohui Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Minglue Zhaohui Technology Co Ltd filed Critical Beijing Minglue Zhaohui Technology Co Ltd
Priority to CN202111367541.4A priority Critical patent/CN114064006A/en
Publication of CN114064006A publication Critical patent/CN114064006A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/72Code refactoring

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides an insertion method, an insertion device, an electronic device and a storage medium of a code block, comprising the following steps: in response to a request of a user to insert a code block in a current program, determining a target position of code block insertion; downloading a target code block selected by a user; calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; generating a reference code of the target code block based on the modified attribute data and inserting the reference code into a target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data. Therefore, the reference code of the code block can be automatically generated according to the attribute data modified by the user and inserted into the appointed position, repeated code development and code redundancy are reduced, the code block with high reusability has flexible expansibility and maintainability, and the code development efficiency is improved.

Description

Code block insertion method and device, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer programming technologies, and in particular, to a code block insertion method, an insertion apparatus, an electronic device, and a storage medium.
Background
In the development process of products, many functions have high similarity, and developers sometimes need to develop some similar business functions for many times, such as building a login interface, dynamically displaying a chart and other page visualization controls.
In the prior art, when a developer develops a similar business function, the developer needs to manually copy and paste corresponding codes or use a third-party plug-in. The copy and paste method causes high redundancy of the code, is not beneficial to the maintenance of the code, and is also easy to generate errors.
Moreover, although highly similar, these business functions still have partial differences, requiring adaptive modifications by developers. Developers can only read through the code to be pasted or the API document of the third-party plug-in until the developers completely master the relevant content, so that the efficiency of code development is low, and the requirements on the code capability of the developers are high. And many third-party plug-ins cannot modify internal logic codes or have a very limited modification range, and cannot meet the requirements of personalized development.
Disclosure of Invention
In view of the above, an object of the present application is to provide a code block insertion method, an insertion apparatus, an electronic device, and a storage medium, which can automatically generate a reference code of a code block according to attribute data modified by a user and insert the reference code into a specified position, reduce repeated code development and code redundancy, have flexible extensibility and maintainability for a code block with high reusability, and improve code development efficiency.
The embodiment of the application provides a code block insertion method, which comprises the following steps:
responding to a request of a user for inserting a code block in a current program, determining a target position for inserting the code block, and displaying a code block list in a preset code library; the code block is a set of codes for constructing a visual component;
in response to the selection operation of the user on the code blocks in the code block list, downloading target code blocks selected by the user;
calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; the attribute data is used for determining the display form of the visual component constructed by the target code block;
generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Further, the downloading a target code block selected by a user in response to a selection operation of the code block in the code block list by the user includes:
determining a storage location of the target code block;
creating a folder of the name at the storage position according to the name of the target code block input by a user;
responding to the selection operation of a user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder;
and decompressing the compressed file of the target code block to the folder to obtain the target code block.
Further, the generating a reference code of the target code block based on the modified attribute data includes:
analyzing the target code block and determining the dependency information of the target code block; the dependency information comprises information of a dependency file required for executing the target code block;
and generating a reference code of the target code block based on the modified attribute data, the dependency information, the storage position of the target code block and the name of the target code block.
Further, generating a code block list in the preset code library by the following method:
and responding to the uploading operation of the user, storing the code block to be uploaded selected by the user to the server, and adding a display entry corresponding to the code block to be uploaded in the code block list.
Further, before retrieving and displaying the attribute data of the target code block, the inserting method further includes:
analyzing the code block aiming at any one code block in the code block list to obtain attribute data of the code block;
and binding the attribute data of the code block with the code block.
Further, the determining a storage location of the target code block includes;
determining a default storage position of the target code block according to the storage position of the current program, wherein the default storage position is the parent storage position of the current program;
or determining the storage position selected by the user as the storage position of the target code block.
An embodiment of the present application further provides an insertion apparatus for a code block, where the insertion apparatus includes:
the determining module is used for responding to a request of a user for inserting a code block in a current program, determining a target position for inserting the code block and displaying a code block list in a preset code library; the code block is a set of codes for constructing a visual component;
the downloading module is used for responding to the selection operation of the user on the code blocks in the code block list and downloading the target code blocks selected by the user;
the modification module is used for calling and displaying the attribute data of the target code block, responding to the modification operation of a user on the attribute data and obtaining the modified attribute data; the attribute data is used for determining the display form of the visual component constructed by the target code block;
the inserting module is used for generating a reference code of the target code block based on the modified attribute data and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Further, the downloading module is configured to, when the downloading module is configured to download the target code block selected by the user in response to the selection operation of the user on the code block in the code block list, the downloading module is configured to;
determining a storage location of the target code block;
creating a folder of the name at the storage position according to the name of the target code block input by a user;
responding to the selection operation of a user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder;
and decompressing the compressed file of the target code block to the folder to obtain the target code block.
Further, when the inserting module is configured to generate the reference code of the target code block based on the modified attribute data, the inserting module is configured to:
analyzing the target code block and determining the dependency information of the target code block; the dependency information comprises information of a dependency file required for executing the target code block;
and generating a reference code of the target code block based on the modified attribute data, the dependency information, the storage position of the target code block and the name of the target code block.
Further, the insertion device further includes: a generation module; the generation module is used for generating a code block list in the preset code library in the following modes:
and responding to the uploading operation of the user, storing the code block to be uploaded selected by the user to the server, and adding a display entry corresponding to the code block to be uploaded in the code block list.
Further, the insertion device further includes: an analysis module; the analysis module is configured to:
analyzing the code block aiming at any one code block in the code block list to obtain attribute data of the code block;
and binding the attribute data of the code block with the code block.
Further, when the downloading module is configured to determine the storage location of the target code block, the downloading module is further configured to:
determining a default storage position of the target code block according to the storage position of the current program, wherein the default storage position is the parent storage position of the current program;
or determining the storage position selected by the user as the storage position of the target code block.
An embodiment of the present application further provides an electronic device, including: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is operating, the machine-readable instructions when executed by the processor performing the steps of the insertion method as described above.
Embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the insertion method as described above.
In the code block insertion method, the code block insertion device, the electronic device and the storage medium provided by the embodiment of the application, a target position for inserting a code block is determined in response to a request of a user for inserting the code block in a current program, and a code block list in a preset code library is displayed; in response to the selection operation of the user on the code blocks in the code block list, downloading target code blocks selected by the user; calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Compared with the method in the prior art that the code block is copied and pasted into the program manually by a user and then the code block is read for modification, the method enables the user to directly modify the attribute data of the code block, automatically generates the reference code of the code block and inserts the reference code into the appointed position, further constructs a corresponding visual assembly, reduces repeated code development and code redundancy, has flexible expansibility and maintainability for code segments with high reusability, and improves code development efficiency.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a flowchart illustrating an insertion method of a code block according to an embodiment of the present application;
fig. 2 shows one of the schematic structural diagrams of an insertion apparatus for a code block provided in an embodiment of the present application;
fig. 3 shows a second schematic structural diagram of an insertion apparatus for a code block according to an embodiment of the present application;
fig. 4 shows a schematic structural diagram of an electronic device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. Every other embodiment that can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present application falls within the protection scope of the present application.
First, an application scenario to which the present application is applicable will be described. The present application is applicable to xx.
Research shows that many functions have high similarity in the development process of products, developers need to manually copy and paste corresponding codes or use third-party plug-ins when developing similar business functions, and the developers are difficult to quickly modify the codes to meet the requirements, so that the code development efficiency is low, and the requirements on the code capability of the developers are high.
Based on this, the embodiment of the application provides a code block insertion method, so as to automatically generate the reference code of the code block and insert the reference code into the specified position, reduce repeated code development and code redundancy, have flexible expansibility and maintainability for the code block with high reusability, and improve the code development efficiency.
Referring to fig. 1, fig. 1 is a flowchart of a code block insertion method according to an embodiment of the present disclosure. As shown in fig. 1, an insertion method provided in an embodiment of the present application includes:
s101, responding to a request of a user for inserting a code block in a current program, determining a target position of code block insertion, and displaying a code block list in a preset code library.
It should be noted that the code block is a collection of codes for constructing a visualization component. The visualization component comprises visualized controls in a page in front-end development, such as a login page, a dynamic display chart and an interface control.
In the step, in response to a request of a user for inserting a code block in a current program, a target position of the code block which is requested to be inserted by the user is determined, and a code block list in a preset code library is displayed. Illustratively, a user selects a target position in a programming interface of a current program through a cursor, then clicks a right mouse button, selects 'insert' in a popup menu, and sends a request for inserting a code block in such a way; in response to the request, a list of code blocks within the preset code library is displayed in the programming interface. Optionally, the programming software is a VS Code (Visual Studio Code), and the preset Code library is pre-installed in the VS Code as a plug-in.
And S102, downloading the target code block selected by the user in response to the selection operation of the user on the code block in the code block list.
In this step, the code block list includes at least one type of display entry of the code block, and the target code block selected by the user is downloaded locally through a selection operation of the user on the code block, for example, clicking an "insert" key in the display entry of the corresponding code block.
Here, the list of code blocks within the preset code library is generated by:
and responding to the uploading operation of the user, storing the code block to be uploaded selected by the user to the server, and adding a display entry corresponding to the code block to be uploaded in the code block list.
In this step, after the user selects the code block to be uploaded, the name, thumbnail, tag, brief introduction, and the like of the code block to be uploaded may be set. Responding to the uploading operation of the user, storing the code blocks to be uploaded selected by the user to the server, adding display entries corresponding to the code blocks to be uploaded in a code block list in a preset code base, and displaying names, thumbnails, labels, brief introduction and the like of the code blocks correspondingly in the display entries.
Further, in response to a selection operation of a user on a code block in the code block list, downloading a target code block selected by the user, including:
and S1021, determining the storage position of the target code block.
In this step, the default storage location of the target code block may be determined directly according to the storage location of the current program. Here, the default storage location is the parent storage location where the storage location of the current program is located. For example, the target code block and the current program are stored in two different subfolders under the same parent folder.
Or popping up a panel for setting a storage position, and determining the storage position selected by the user as the storage position of the target code block.
S1022, according to the name of the target code block input by the user, creating a folder of the name in the storage position.
In this step, a panel in which the name of the code block is set may be popped up, and a folder of the name may be automatically created at the storage location determined in S1021, according to the name of the target code block input by the user.
S1023, responding to the selection operation of the user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder.
In this step, the compressed file of the target code block is downloaded from the server to the folder created in S1022 by sending a request to the server to download the target code block selected by the user. Optionally, the compressed file of the code block is a compressed file in a Zip compressed file format.
S1024, decompressing the compressed file of the target code block to the folder to obtain the target code block.
In this step, the compressed file of the downloaded target code block is decompressed to the folder, and the target code block is obtained. Furthermore, after the target code block is decompressed, the compressed file of the target code block can be automatically deleted, so that redundant resources are prevented from being generated and redundant space is not occupied.
S103, calling and displaying the attribute data of the target code block, and responding to the modification operation of the user on the attribute data to obtain the modified attribute data.
Here, the attribute data is used to determine a presentation form of the visualization component constructed by the target code block. Illustratively, when the visualization component is a dynamic display chart, the presentation form of the dynamic display chart includes the display value, style (pie chart or bar chart, etc.), color, transparency, etc. of the chart.
In this step, after downloading the target code block, the attribute data of the target code block is retrieved and displayed in the pop-up attribute panel. And obtaining modified attribute data according to the modification of the user.
Further, before retrieving and displaying the attribute data of the target code block, the inserting method further includes:
step 1, analyzing the code block aiming at any code block in the code block list to obtain the attribute data of the code block.
And 2, binding the attribute data of the code block with the attribute data of the code block.
The above step 1 and step 2 may also be performed when the user uploads the code block. The analyzing the code block to obtain the attribute data of the code block includes:
automatically analyzing attribute data of the code block according to the attribute definition of the visual component corresponding to the code block; the attribute data includes an attribute data name and an attribute data type, and further, the simulation data may be generated as a value of the attribute data and as a reference default value when a subsequent user modifies the attribute data, where, for example, the attribute data name is usertype, the attribute data type is number, and the simulation data is 3343. The user can also directly generate reference codes based on the simulation data without modifying the attribute data to construct the visual component.
Optionally, a babel toolkit is used to parse the attribute data of the code block. Here, Babel, a JavaScript compiler, is a tool kit that can parse a front-end code syntax tree.
Therefore, by binding the attribute data of each code block with the code block, when a user selects a target code block, the attribute data of the target code block can be called and displayed on a popup attribute panel, and the user can quickly modify the attribute data. The user can obtain the attribute data of the code block for modification without reading the code block, and the corresponding visual component can be constructed through simple modification operation, so that the flexible expansibility and maintainability of the code block with high reusability are further improved, the code development efficiency is improved, and the requirement on the code capability of developers is lower.
S104, generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position.
Wherein the generating a reference code of the target code block based on the modified attribute data comprises:
s1041, analyzing the target code block, and determining the dependency information of the target code block.
In this step, dependency information of a target code block may be determined by parsing a package json file in the code block, where the dependency information includes information of a dependency file required to execute the target code block. Optionally, a babel toolkit is used to parse the dependency information of the code block.
S1042, generating a reference code of the target code block based on the modified attribute data, the dependency information, the storage position of the target code block and the name of the target code block.
In this step, based on the dependency information, the dependent file required for executing the target code block is downloaded and installed, otherwise, when the dependent file is not installed, the reference code of the target code block is inserted into the current program, which may cause a program error report, or even crash.
Here, the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visualization component according to the modified attribute data. Illustratively, a green bar chart with a value of 30, or a blue landing page, etc. is constructed based on the user-modified attribute data.
Furthermore, after the reference code of the code block is inserted into the target position, the current program can be formatted and compiled, and then the display form of the visual component corresponding to the code block is checked in the browser. If the display form does not meet the user requirement, the user can recall the attribute panel to display the attribute data, modify the attribute data and correspondingly update the reference code inserted in the current program until the display form of the visual component meets the user requirement.
Furthermore, if the attribute data cannot meet the requirement of a user for constructing the visual component, a folder stored by the target code block can be directly popped up, the source code of the target code block is exposed for the user to modify, and the user is prevented from searching the folder layer by layer. Therefore, under the conditions of huge program engineering, more related codes and complex folders, the efficiency of code writing can be greatly improved. The user can upload the modified code blocks to the preset code base and the server again for updating.
In this way, according to the code block insertion method provided by the embodiment of the application, in response to a request of a user for inserting a code block in a current program, a target position for inserting the code block is determined, and a code block list in a preset code library is displayed; in response to the selection operation of the user on the code blocks in the code block list, downloading target code blocks selected by the user; calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Compared with the method in the prior art that the code block is copied and pasted into the program manually by a user and then the code block is read for modification, the method enables the user to directly modify the attribute data of the code block, automatically generates the reference code of the code block and inserts the reference code into the appointed position, further constructs a corresponding visual assembly, reduces repeated code development and code redundancy, has flexible expansibility and maintainability for code segments with high reusability, and improves code development efficiency.
Referring to fig. 2 and fig. 3, fig. 2 is a first schematic structural diagram of an apparatus for inserting a code block according to an embodiment of the present application, and fig. 3 is a second schematic structural diagram of an apparatus for inserting a code block according to an embodiment of the present application. As shown in fig. 2, the insertion device 200 includes:
a determining module 210, configured to determine, in response to a request from a user to insert a code block in a current program, a target location of the code block insertion, and display a code block list in a preset code library; the code block is a set of codes for constructing a visual component;
a downloading module 220, configured to respond to a selection operation of a user on a code block in the code block list, and download a target code block selected by the user;
a modifying module 230, configured to invoke and display attribute data of the target code block, and obtain modified attribute data in response to a modification operation performed on the attribute data by a user; the attribute data is used for determining the display form of the visual component constructed by the target code block;
an inserting module 240, configured to generate a reference code of the target code block based on the modified attribute data, and insert the reference code into the target location; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Further, the downloading module 220 is configured to, when the downloading module 220 is configured to download the target code block selected by the user in response to the selection operation of the user on the code block in the code block list;
determining a storage location of the target code block;
creating a folder of the name at the storage position according to the name of the target code block input by a user;
responding to the selection operation of a user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder;
and decompressing the compressed file of the target code block to the folder to obtain the target code block.
Further, when the inserting module 240 is configured to generate the reference code of the target code block based on the modified attribute data, the inserting module 240 is configured to:
analyzing the target code block and determining the dependency information of the target code block; the dependency information comprises information of a dependency file required for executing the target code block;
and generating a reference code of the target code block based on the modified attribute data, the dependency information, the storage position of the target code block and the name of the target code block.
Further, as shown in fig. 3, the insertion device 200 further includes: a generation module 250 and a parsing module 260;
the generating module 250 is configured to generate a list of code blocks in the preset code library by:
and responding to the uploading operation of the user, storing the code block to be uploaded selected by the user to the server, and adding a display entry corresponding to the code block to be uploaded in the code block list.
The parsing module 260 is configured to:
analyzing the code block aiming at any one code block in the code block list to obtain attribute data of the code block;
and binding the attribute data of the code block with the code block.
Further, when the downloading module 220 is configured to determine the storage location of the target code block, the downloading module 220 is further configured to:
determining a default storage position of the target code block according to the storage position of the current program, wherein the default storage position is the parent storage position of the current program;
or determining the storage position selected by the user as the storage position of the target code block.
In this way, the code block insertion apparatus provided in the embodiment of the present application, in response to a request from a user to insert a code block in a current program, determines a target position of code block insertion, and displays a code block list in a preset code library; in response to the selection operation of the user on the code blocks in the code block list, downloading target code blocks selected by the user; calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
Compared with the method in the prior art that the code block is copied and pasted into the program manually by a user and then the code block is read for modification, the method enables the user to directly modify the attribute data of the code block, automatically generates the reference code of the code block and inserts the reference code into the appointed position, further constructs a corresponding visual assembly, reduces repeated code development and code redundancy, has flexible expansibility and maintainability for code segments with high reusability, and improves code development efficiency.
Referring to fig. 4, fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 4, the electronic device 400 includes a processor 410, a memory 420, and a bus 430.
The memory 420 stores machine-readable instructions executable by the processor 410, when the electronic device 400 runs, the processor 410 communicates with the memory 420 through the bus 430, and when the machine-readable instructions are executed by the processor 410, the steps of the insertion method in the method embodiment shown in fig. 1 may be executed.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the step of the insertion method in the method embodiment shown in fig. 1 may be executed.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. An insertion method of a code block, the insertion method comprising:
responding to a request of a user for inserting a code block in a current program, determining a target position for inserting the code block, and displaying a code block list in a preset code library; the code block is a set of codes for constructing a visual component;
in response to the selection operation of the user on the code blocks in the code block list, downloading target code blocks selected by the user;
calling and displaying attribute data of the target code block, and responding to modification operation of a user on the attribute data to obtain modified attribute data; the attribute data is used for determining the display form of the visual component constructed by the target code block;
generating a reference code of the target code block based on the modified attribute data, and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
2. The insertion method according to claim 1, wherein the downloading the target code block selected by the user in response to the selection operation of the code block in the code block list by the user comprises:
determining a storage location of the target code block;
creating a folder of the name at the storage position according to the name of the target code block input by a user;
responding to the selection operation of a user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder;
and decompressing the compressed file of the target code block to the folder to obtain the target code block.
3. The insertion method according to claim 2, wherein the generating a reference code of the target code block based on the modified attribute data comprises:
analyzing the target code block and determining the dependency information of the target code block; the dependency information comprises information of a dependency file required for executing the target code block;
and generating a reference code of the target code block based on the modified attribute data, the dependency information, the storage position of the target code block and the name of the target code block.
4. The insertion method according to claim 2, wherein the list of code blocks within the preset code library is generated by:
and responding to the uploading operation of the user, storing the code block to be uploaded selected by the user to the server, and adding a display entry corresponding to the code block to be uploaded in the code block list.
5. The insertion method according to claim 1, wherein before retrieving and displaying the attribute data of the target code block, the insertion method further comprises:
analyzing the code block aiming at any one code block in the code block list to obtain attribute data of the code block;
and binding the attribute data of the code block with the code block.
6. The insertion method according to claim 2, wherein the determining a storage location of the target code block comprises;
determining a default storage position of the target code block according to the storage position of the current program, wherein the default storage position is the parent storage position of the current program;
or determining the storage position selected by the user as the storage position of the target code block.
7. An insertion apparatus of a code block, the insertion apparatus comprising:
the determining module is used for responding to a request of a user for inserting a code block in a current program, determining a target position for inserting the code block and displaying a code block list in a preset code library; the code block is a set of codes for constructing a visual component;
the downloading module is used for responding to the selection operation of the user on the code blocks in the code block list and downloading the target code blocks selected by the user;
the modification module is used for calling and displaying the attribute data of the target code block, responding to the modification operation of a user on the attribute data and obtaining the modified attribute data; the attribute data is used for determining the display form of the visual component constructed by the target code block;
the inserting module is used for generating a reference code of the target code block based on the modified attribute data and inserting the reference code into the target position; and the reference code is used for calling and executing the target code block when the current program is executed to the target position, so that the target code block constructs a corresponding visual component according to the modified attribute data.
8. The insertion device according to claim 7, wherein the downloading module is configured to, when configured to download the target code chunk selected by the user in response to the selection operation of the code chunk in the code chunk list by the user, the downloading module is configured to;
determining a storage location of the target code block;
creating a folder of the name at the storage position according to the name of the target code block input by a user;
responding to the selection operation of a user, sending a request for downloading the target code block to a server, and downloading the compressed file of the target code block from the server to the folder;
and decompressing the compressed file of the target code block to the folder to obtain the target code block.
9. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating over the bus when the electronic device is operating, the machine-readable instructions being executable by the processor to perform the steps of the insertion method of any of claims 1 to 6.
10. A computer-readable storage medium, characterized in that a computer program is stored on the computer-readable storage medium, which computer program, when being executed by a processor, performs the steps of the insertion method according to one of claims 1 to 6.
CN202111367541.4A 2021-11-18 2021-11-18 Code block insertion method and device, electronic equipment and storage medium Pending CN114064006A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111367541.4A CN114064006A (en) 2021-11-18 2021-11-18 Code block insertion method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111367541.4A CN114064006A (en) 2021-11-18 2021-11-18 Code block insertion method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114064006A true CN114064006A (en) 2022-02-18

Family

ID=80277771

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111367541.4A Pending CN114064006A (en) 2021-11-18 2021-11-18 Code block insertion method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114064006A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080127061A1 (en) * 2006-10-02 2008-05-29 Bulent Kasman Method and system for editing code
CN106445556A (en) * 2016-10-18 2017-02-22 中国银行股份有限公司 Visualized code generation method and system thereof
CN111367513A (en) * 2020-02-20 2020-07-03 北京达佳互联信息技术有限公司 Code completion method and device, electronic equipment and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080127061A1 (en) * 2006-10-02 2008-05-29 Bulent Kasman Method and system for editing code
CN106445556A (en) * 2016-10-18 2017-02-22 中国银行股份有限公司 Visualized code generation method and system thereof
CN111367513A (en) * 2020-02-20 2020-07-03 北京达佳互联信息技术有限公司 Code completion method and device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
小白&小菜: "html引用公共代码", 《 HTTPS://WWW.CNBLOGS.COM/DUANZHENZHEN/P/11132555.HTML》 *

Similar Documents

Publication Publication Date Title
CN111552473B (en) Application processing method, device and equipment
US10318628B2 (en) System and method for creation of templates
CN111443911A (en) Page development method and device, electronic equipment and computer storage medium
US20150100946A1 (en) Using mock data to validate applications
CN111176717B (en) Method and device for generating installation package and electronic equipment
US11886792B1 (en) Model documentation generation system
CN111740948B (en) Data packet issuing method, dynamic updating method, device, equipment and medium
JP5416112B2 (en) Interactive user interface definition
US20110023014A1 (en) Method and apparatus for modifying an executable application using in-memory object representation
CN115237436A (en) Application deployment method and device, electronic equipment and readable storage medium
CN112000334A (en) Page development method, device, server and storage medium
US10514940B2 (en) Virtual application package reconstruction
CN117093386B (en) Page screenshot method, device, computer equipment and storage medium
CN113656005A (en) Application component library construction method, application component configuration method and related device
CN114064006A (en) Code block insertion method and device, electronic equipment and storage medium
CN116028062A (en) Target code generation method, NPU instruction display method and device
JP6795767B2 (en) Information processing device and its processing method and program
US20210232562A1 (en) Container-image reproduction and debugging
CN112068820B (en) Method and device for processing configuration of micro-service, computer equipment and storage medium
CN115167941A (en) Front-end component processing method, device, terminal and storage medium
CN114168875A (en) Page program generation method and device, computer equipment and storage medium
CN113377453A (en) Picture processing method and device and electronic equipment
JP2012133567A (en) Information processor, control method thereof, and program
US10394932B2 (en) Methods and systems for combining a digital publication shell with custom feature code to create a digital publication
JP2011233104A (en) Information processing system, information processor, information processing method, program, and recording medium

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: 20220218