Sketch-based business page generation method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to a page development technology, in particular to a method, a device, equipment and a storage medium for generating a service page based on Sketch.
Background
Sketch is created for icon design and interface design, is a one-stop application with an excellent UI, and is a vector drawing application suitable for all designers, and vector drawing is also the best way to perform web page, icon and interface design at present.
However, a specific DSL (Domain specific language) cannot be directly generated through Sketch, and even if a front-end developer is a page of a simple rule for development, the front-end developer is required to develop a view layer code to be specifically applied to different fields, so that the work efficiency of the front-end developer is greatly reduced. In addition, the DSL framework code translated by Sketch is not componentized, inconvenient to maintain, and does not support custom component libraries.
Disclosure of Invention
Embodiments of the present invention provide a method, an apparatus, a device, and a storage medium for generating a service page based on Sketch, so as to implement efficient page development through Sketch.
To achieve the object, an embodiment of the present invention provides a method for generating a service page based on Sketch, where the method includes:
acquiring a preformed Sketch file;
generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file;
generating a first service page according to the Sketch file;
acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user;
and generating a second service page according to the first interface component.
Further characterized in that the Sketch file includes at least one Sketch component.
Further, the generating an interface component library including interface components in a plurality of domain-specific languages according to the Sketch file includes:
generating a first component code from the at least one Sketch component;
generating second component code in a plurality of domain-specific languages from the first component code;
and constructing an interface component library according to the second component code.
Further, the generating a first service page according to the Sketch file includes:
acquiring at least one Sketch component in the Sketch file;
and splicing the at least one Sketch component to generate a first business page.
Further, the acquiring, from the interface component library, the first interface component corresponding to the first service page according to the category of the domain-specific language selected by the user includes:
acquiring a first Sketch component for generating the first service page;
and acquiring a second component code corresponding to the first Sketch component from the interface component library according to the type of the domain-specific language selected by the user.
Further, the generating a second service page according to the first interface component includes:
and generating a second service page according to the second component code.
Further, the categories of the domain-specific languages include applet, VUE, Flutter, and Angular.
In one aspect, an embodiment of the present invention further provides a device for generating a service page based on Sketch, where the device includes:
the Sketch file acquisition module is used for acquiring a Sketch file which is completed in advance;
the component library generating module is used for generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file;
the first page generating module is used for generating a first service page according to the Sketch file;
the interface component acquisition module is used for acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user;
and the second page generation module is used for generating a second service page according to the first interface component.
On the other hand, an embodiment of the present invention further provides a service page generating device based on Sketch, where the device includes: one or more processors; a storage device for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement a method as provided by any embodiment of the invention.
In yet another aspect, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the method provided in any embodiment of the present invention.
The embodiment of the invention obtains the Sketch file completed in advance; generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file; generating a first service page according to the Sketch file; acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user; and generating a second service page according to the first interface component, solving the problem that the Sketch cannot directly generate a specific DSL, and realizing the effect of efficiently developing the page through the Sketch.
Drawings
Fig. 1 is a schematic flowchart of a Sketch-based service page generation method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a Sketch-based service page generation method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a Sketch-based service page generation apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a Sketch-based service page generation device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are for purposes of illustration and not limitation. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the steps as a sequential process, many of the steps can be performed in parallel, concurrently or simultaneously. In addition, the order of the steps may be rearranged. A process may be terminated when its operations are completed, but may have additional steps not included in the figure. A process may correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
Furthermore, the terms "first," "second," and the like may be used herein to describe various orientations, actions, steps, elements, or the like, but the orientations, actions, steps, or elements are not limited by these terms. These terms are only used to distinguish one direction, action, step or element from another direction, action, step or element. For example, a first module may be termed a second module, and, similarly, a second module may be termed a first module, without departing from the scope of the present application. The first module and the second module are both modules, but they are not the same module. The terms "first", "second", etc. are not to be construed as indicating or implying a relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first", "second", may explicitly or implicitly include one or more of the described features. In the description of the embodiments of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Example one
As shown in fig. 1, an embodiment of the present invention provides a method for generating a service page based on Sketch, where the method includes:
s110, acquiring a preformed Sketch file.
And S120, generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file.
In this embodiment, if a developer needs to generate a service page, for example, a service page of a wechat applet, a design draft may be completed through Sketch software to obtain a Sketch file. And then generating an interface component library according to the obtained Sketch file, wherein the interface component library comprises interface components of multiple domain-specific languages corresponding to the Sketch file, for example, x components, for example, 10 components, are used in the Sketch file, and then the interface component library also comprises x interface components of the domain-specific language of the WeChat applet. Step S110 and step S120 in the embodiment of the present invention may be completed in advance, and the Sketch file and the corresponding interface component library may be used repeatedly.
And S130, generating a first service page according to the Sketch file.
S140, acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user.
S150, generating a second business page according to the first interface component.
In this embodiment, in the actual service page development process, because the Sketch file and the corresponding interface component library are completed in advance, when the Sketch file and the corresponding interface component library are repeatedly used, a developer only needs to generate a first service page according to the Sketch file, but the first service page cannot be actually used, and is formed by only assembling x components used in the Sketch file. Further, if the category of the domain-specific language selected by the developer is the wechat applet, a first interface component corresponding to the first service page is obtained from the interface component library, wherein the first interface component is an interface component of the wechat applet. Therefore, the second business page can be generated through the first interface component, the development of the business page is completed, and the method is very efficient and convenient for developers.
The embodiment of the invention obtains the Sketch file completed in advance; generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file; generating a first service page according to the Sketch file; acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user; and generating a second service page according to the first interface component, solving the problem that the Sketch cannot directly generate a specific DSL, and realizing the effect of efficiently developing the page through the Sketch.
Example two
As shown in fig. 2, a second embodiment of the present invention provides a method for generating a service page based on Sketch, and the second embodiment of the present invention is further explained on the basis of the first embodiment of the present invention, where the method includes:
s210, obtaining a pre-finished Sketch file, wherein the Sketch file comprises at least one Sketch component.
And S220, generating a first component code according to the at least one Sketch component.
And S230, generating second component codes of multiple domain-specific languages according to the first component codes.
S240, constructing an interface component library according to the second component code.
In this embodiment, if a developer needs to generate a service page, for example, a service page of a wechat applet, a design draft may be completed through Sketch software to obtain a Sketch file, where the Sketch file includes at least one Sketch component. And then acquiring a first component code of at least one Sketch component, generating a second component code of a plurality of domain-specific languages according to the first component code, wherein the types of the domain-specific languages comprise an applet, a VUE, a Flutter, an Angular and the like, and after the second component codes of the applet, the VUE, the Flutter and the Angular are generated, an interface component library can be constructed according to the second component code.
And S250, acquiring at least one Sketch component in the Sketch file.
S260, splicing the at least one Sketch component to generate a first business page.
S270, acquiring a first Sketch component for generating the first service page.
S280, acquiring a second component code corresponding to the first Sketch component from the interface component library according to the type of the domain specific language selected by the user.
And S290, generating a second service page according to the second component code.
In this embodiment, the first service page is generated by obtaining at least one Sketch component in the Sketch file, and then splicing the at least one Sketch component to generate the first service page. Further, after the first service page is generated, the Sketch component for generating the first service page may be continuously obtained, it should be noted that the first Sketch component for generating the first service page is not necessarily all Sketch components included in the Sketch file, and a developer may further adjust when the first service page is generated without using all Sketch components. After a first Sketch component for generating a first service page is obtained, a second component code corresponding to the first Sketch component can be obtained from a pre-established interface component library according to the type of the domain specific language selected by the user, wherein the second component code is a component code of the type of the domain specific language selected by the user, and finally, a second service page is generated according to the component codes, so that the development of the service page required by the user is completed.
EXAMPLE III
As shown in fig. 3, a Sketch-based service page generation apparatus 100 is provided in the third embodiment of the present invention, and the Sketch-based service page generation apparatus 100 provided in the third embodiment of the present invention can execute the Sketch-based service page generation method provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects of the execution method. The Sketch-based service page generating device 100 comprises a Sketch file acquiring module 200, a component library generating module 300, a first page generating module 400, an interface component acquiring module 500 and a second page generating module 600.
Specifically, the Sketch file acquiring module 200 is configured to acquire a Sketch file completed in advance; the component library generating module 300 is configured to generate an interface component library including interface components in multiple domain-specific languages according to the Sketch file; the first page generating module 400 is configured to generate a first service page according to the Sketch file; the interface component obtaining module 500 is configured to obtain a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user; the second page generating module 600 is configured to generate a second service page according to the first interface component.
In this embodiment, the Sketch file includes at least one Sketch component. The categories of domain-specific languages include applet, VUE, Flutter, and Angular. The component library generating module 300 is specifically configured to generate a first component code according to the at least one Sketch component; generating second component code in a plurality of domain-specific languages from the first component code; and constructing an interface component library according to the second component code. The first page generating module 400 is specifically configured to obtain at least one Sketch component in the Sketch file; and splicing the at least one Sketch component to generate a first business page. The interface component obtaining module 500 is specifically configured to obtain a first Sketch component for generating the first service page; and acquiring a second component code corresponding to the first Sketch component from the interface component library according to the type of the domain-specific language selected by the user. The second page generating module 600 is specifically configured to generate a second service page according to the second component code.
Example four
Fig. 4 is a schematic structural diagram of a Sketch-based service page generation computer device according to a fourth embodiment of the present invention. FIG. 4 illustrates a block diagram of an exemplary computer device 12 suitable for use in implementing embodiments of the present invention. The computer device 12 shown in FIG. 4 is only one example and should not bring any limitations to the functionality or scope of use of embodiments of the present invention.
As shown in FIG. 4, computer device 12 is in the form of a general purpose computing device. The components of computer device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. Computer device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 4, and commonly referred to as a "hard drive"). Although not shown in FIG. 4, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with the other modules of computer device 12 via bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, implementing the methods provided by the embodiments of the present invention:
acquiring a preformed Sketch file;
generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file;
generating a first service page according to the Sketch file;
acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user;
and generating a second service page according to the first interface component.
EXAMPLE five
The fifth embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the methods provided in all the embodiments of the present invention of the present application:
acquiring a preformed Sketch file;
generating an interface component library comprising interface components of multiple domain specific languages according to the Sketch file;
generating a first service page according to the Sketch file;
acquiring a first interface component corresponding to the first service page from the interface component library according to the type of the domain specific language selected by the user;
and generating a second service page according to the first interface component.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.