Vue-based front-end page creating method and related equipment thereof
By generating page function JSON data and template components, saving them to a persistent database, and dynamically parsing them on the front-end site, the problem of low efficiency and difficulty in front-end page production in the existing technology is solved, and efficient front-end page creation and rendering is achieved.
Patent Information
- Application Number
- CN202310260142.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-07
- Publication Date
- 2024-09-10
AI Technical Summary
The existing Vue-based front-end page development technology has problems such as low production efficiency and high difficulty, especially in generating source code files and binding routing information.
By generating page function JSON data and selecting template components and page routing information, save it to a persistent database, and dynamically complete page file-less creation on the front-end site. Use template components to parse JSON data to achieve dynamic page rendering.
It improves the efficiency of front-end page production, reduces the difficulty of production, realizes simple configuration of visual page functions, supports editability and publishability, completes page creation online, and saves it directly to users.
Smart Images

Figure CN118626083A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of front-end page development, and more specifically, to a front-end page creation method based on Vue and related equipment. Background Art
[0002] In the prior art, low-code tools are often established based on Vue for front-end page development, so as to pursue the convenience of team collaboration, reduce the coupling between program modules under the software architecture, and improve the readability of the code. Although low-code tools based on Vue for front-end page development have many advantages, they also have disadvantages such as the need to generate source code files and save them to the project after the page is created from the low-code tool, the need to create routing information in the code and bind the source code files, and the inability to dynamically parse JSON data to generate and render real page functions, resulting in low efficiency and difficulty in front-end page production.
[0003] To sum up, the existing Vue-based front-end page development technology has technical problems such as low efficiency and difficulty in front-end page production. Summary of the invention
[0004] The technical problem to be solved by the present invention is that, in view of the shortcomings of the above-mentioned technical solutions, a front-end page creation method based on Vue and related equipment are provided to improve the efficiency of front-end page production and reduce the difficulty of front-end page production.
[0005] In a first aspect, the present invention provides a front-end page creation method based on Vue, comprising the following steps:
[0006] S1. Generate page function JSON data based on Vue, and select template components and page routing information; the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data;
[0007] S2. Save the page function JSON data, the configuration information of the template component and the routing information to a persistent database;
[0008] S3. Respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
[0009] Further, step S1 includes the following steps:
[0010] S10, create an HTML page and introduce a Vue.js file, wherein the Vue.js file includes a js code area;
[0011] S11, creating a Vue core object in the js code area for data binding;
[0012] S12. Write a view based on the bound data to generate page function JSON data, and select template components and page routing information.
[0013] Furthermore, the description of the front-end page configuration by the page function JSON data includes:
[0014] Description of the page control configuration and the button configuration of the front-end page;
[0015] Description of the table configuration for the front-end page and description of the request configuration for the front-end page.
[0016] Further, step S2 includes the following steps:
[0017] S20, determining the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information;
[0018] S21, calculating storage space according to the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information;
[0019] S22. According to the calculation result of the storage space, the page function JSON data, the configuration information of the template component and the routing information are saved to a persistent database.
[0020] Furthermore, the persistent database includes a local database and a cloud database; the page function JSON data, the configuration information of the template component and the routing information are saved to the local database and backed up to the persistent database.
[0021] Further, step S3 includes the following steps:
[0022] S30, responding to the front-end site access request, reading the routing information and dynamically creating a route on the front-end page;
[0023] S31, reading the page function JSON data, and dynamically parsing the page function JSON data through the template component, so as to dynamically complete the front-end page file-free creation at the front-end site.
[0024] Further, the page function JSON data is dynamically parsed by the template component, including:
[0025] Dynamically parsing page elements through the template component;
[0026] The script is dynamically parsed through the template component.
[0027] Furthermore, the dynamic parsing of page elements by template components includes:
[0028] Dynamically parse controls through template components, and dynamically parse buttons through template components;
[0029] The table is dynamically parsed through the template component, and the request message is dynamically parsed through the template component.
[0030] In a second aspect, the present invention provides a front-end page creation device based on Vue, comprising:
[0031] A data generation selection module is used to generate page function JSON data based on Vue, and select template components and page routing information; the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data;
[0032] A data persistence module, used to save the page function JSON data, the configuration information of the template component and the routing information to a persistent database;
[0033] The front-end page creation module is used to respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
[0034] In a third aspect, the present invention provides a computer device comprising: a processor, a memory and a computer program; the memory is used to store the computer program; the processor is used to execute the computer program stored in the memory to implement any of the Vue-based front-end page creation methods described above.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] The present invention provides a front-end page creation method based on Vue and related equipment thereof. The method generates page function JSON data based on Vue, and selects a template component and page routing information. The page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data. Then, the page function JSON data, the configuration information of the template component and the routing information are saved in a persistent database. Then, by responding to a front-end site access request, the front-end page is dynamically created without files at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information, so that simple configuration of visual page function JSON data, template components and routing information is realized, the page production efficiency is improved, the persistently saved data is editable and publishable, the page is created without files at the front-end site, the front-end page is created online, and the data is saved directly to the user, thereby improving the front-end page production efficiency and reducing the difficulty of front-end page production. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 It is a flow chart of the front-end page creation method based on Vue of the present invention;
[0038] Figure 2 It is a structural schematic diagram of a front-end page creation device based on Vue of the present invention;
[0039] Figure 3 It is a schematic diagram of the architecture of the computer device of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0041] It should be noted that if the terms "first", "second", etc. appear in the specification and claims of the present invention and the above-mentioned drawings, their purpose is to distinguish similar objects, and they are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein.
[0042] Embodiment 1
[0043] See also Figure 1 , Embodiment 1 provides a front-end page creation method based on Vue, comprising the following steps:
[0044] S1. Generate page function JSON data based on Vue, and select template components and page routing information; the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data;
[0045] S2. Save the page function JSON data, the configuration information of the template component and the routing information to a persistent database;
[0046] S3. Respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
[0047] It should be noted that the Vue-based front-end page creation method provided in this embodiment can be run on a computer device, for example, on a server side. The computer device, as the execution subject of all or part of the steps in the Vue-based front-end page creation method, can execute steps S1, S2 and S3 in this embodiment, and can also execute part or all of the steps of the method involved below. In this embodiment, by generating page function JSON data based on Vue, and selecting template components and page routing information, the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data, and then by saving the page function JSON data, the configuration information of the template component and the routing information to a persistent database, and then by responding to the front-end site access request, according to the configuration information of the template component, the page function JSON data and the routing information, the front-end page is dynamically created without files at the front-end site, and simple configuration of visual page function JSON data, template components and routing information is realized, the efficiency of page production is improved, and the persistent storage data is editable and publishable. The page is created without files at the front-end site, the front-end page is created online, and the user is saved directly, thereby improving the efficiency of front-end page production and reducing the difficulty of front-end page production. Among them, Vue, as a low-code tool, generates page function JSON data based on Vue, and selects template components and page routing information, which can reduce complex code writing and improve page production efficiency.
[0048] Specifically in step S1, the computer device can generate page function JSON data based on Vue, and select template components and page routing information. Among them, the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data. In some specific embodiments, step S1 includes the steps of: S10, creating an HTML page and introducing a Vue.js file, the Vue.js file includes a js code area; S11, creating a Vue core object in the js code area for data binding; S12, writing a view according to the bound data to generate page function JSON data, and select template components and page routing information. Further, the description of the front-end page configuration in the page function JSON data includes: a description of the page control configuration of the front-end page and a description of the button configuration of the front-end page; a description of the table configuration of the front-end page and a description of the request configuration of the front-end page.
[0049] Specifically in step S2, the computer device saves the page function JSON data, the configuration information of the template component, and the routing information to a persistent database. In some specific embodiments, step S2 includes the steps of: S20, determining the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information; S21, calculating the storage space according to the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information; S22, according to the calculation result of the storage space, saving the page function JSON data, the configuration information of the template component, and the routing information to a persistent database. Further, the persistent database includes a local database and a cloud database; the page function JSON data, the configuration information of the template component, and the routing information are saved to the local database and backed up to the persistent database.
[0050] Specifically, in step S3, the computer device responds to the front-end site access request, and dynamically completes the front-end page fileless creation at the front-end site according to the configuration information of the template component, the page function JSON data, and the routing information. In some specific embodiments, step S3 includes the steps of: S30, responding to the front-end site access request, reading the routing information to dynamically create a route at the front-end page; S31, reading the page function JSON data, and dynamically parsing the page function JSON data through the template component to dynamically complete the front-end page fileless creation at the front-end site. Further, the dynamic parsing of the page function JSON data through the template component includes: dynamically parsing page elements through the template component; dynamically parsing scripts through the template component. Further, the dynamic parsing of page elements through the template component includes: dynamically parsing controls through the template component, and dynamically parsing buttons through the template component; dynamically parsing tables through the template component, and dynamically parsing request messages through the template component.
[0051] It should be noted that, by providing the method of reading the routing information to dynamically create routes on the front-end page, reading the page function JSON data, and dynamically parsing the page function JSON data through the template component, it is possible to dynamically complete the file-free creation of the front-end page on the front-end site, thereby avoiding the need to generate source code files and save them to the project after the page is created, avoiding the need to create routing information in the code and bind the source code files, avoiding the inability to dynamically parse JSON data to generate and render real page functions, etc., thereby improving the efficiency of front-end page production and reducing the difficulty of page production.
[0052] In some improved embodiments, the script is dynamically parsed through the template component, including: using newFunction to bind the script to the methods lifecycle of Vue, thereby achieving complete and efficient parsing of the script.
[0053] In some improved embodiments, the page function JSON data is dynamically parsed through the template component, including: parsing the form data through the template component; when parsing the form data, passing the form data into the template component, traversing and rendering the corresponding component through the type type; the form data corresponds to the form element, and the built-in form corresponds to the data object; binding the data parsing method in the vue file, intercepting the parameters corresponding to the data parsing method and executing the corresponding data parsing method.
[0054] Furthermore, when parsing the form data, different components are linked and configured through data options. Components at different levels include display level limitations. When the data of the upper-level component changes, the lower-level component needs to display the component data of the corresponding upper-level component. Among them, components at different levels are set according to actual needs. Exemplarily, different components include a provincial drop-down box, a municipal drop-down box, and a district-level drop-down box; when the province in the provincial drop-down box changes, the municipal drop-down box needs to display the city data of the corresponding province; when the city in the municipal drop-down box changes, the district-level drop-down box needs to display the district-county data of the corresponding city.
[0055] Embodiment 2
[0056] See also Figure 2 This embodiment provides a front-end page creation device based on Vue, including:
[0057] A data generation selection module is used to generate page function JSON data based on Vue, and select template components and page routing information; the page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data;
[0058] A data persistence module, used to save the page function JSON data, the configuration information of the template component and the routing information to a persistent database;
[0059] The front-end page creation module is used to respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
[0060] The present embodiment provides a front-end page creation device based on Vue, which generates page function JSON data based on Vue and selects template components and page routing information. The page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data. Then, the page function JSON data, the configuration information of the template component and the routing information are saved to a persistent database, and then, by responding to the front-end site access request, the front-end page is dynamically created without files at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information, so as to realize simple configuration of visual page function JSON data, template components and routing information, improve the efficiency of page production, persist the saved data to make it editable and publishable, complete the fileless page creation at the front-end site, complete the front-end page creation online, and save it directly to the user, thereby improving the efficiency of front-end page production and reducing the difficulty of front-end page production.
[0061] Embodiment 3
[0062] See also Figure 3 , this embodiment provides a computer device, comprising: a processor, a memory and a computer program; the memory is used to store the computer program; the processor is used to execute the computer program stored in the memory to implement any of the above-mentioned Vue-based front-end page creation methods.
[0063] In this embodiment, when the computer device runs any of the above-mentioned Vue-based front-end page creation methods, page function JSON data is generated based on Vue, and a template component and page routing information are selected. The page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data, and then the page function JSON data, the configuration information of the template component and the routing information are saved to a persistent database, and then the front-end site access request is responded to. The front-end page is dynamically created without files at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information, so as to realize simple configuration of visual page function JSON data, template components and routing information, improve the efficiency of page production, persist the saved data to make it editable and publishable, complete the fileless page creation at the front-end site, complete the front-end page creation online, and save it directly to the user, thereby improving the efficiency of front-end page production and reducing the difficulty of front-end page production.
[0064] It should be noted that the computer device includes a memory, a processor, and a network interface that are connected to each other through a system bus. It should be noted that only some components of the computer device are shown in the figure, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable gate arrays (Field-Programmable Gate Array, FPGA), digital processors (Digital Signal Processor, DSP), embedded devices, etc. The computer device can be a computing device such as a smart phone, a smart wearable device, etc. The computer device can interact with the user through a keyboard, a mouse, a remote control, a touchpad or a voice control device. The memory includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory can be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In other embodiments, the memory can also be an external storage device of a computer device, such as a plug-in hard disk equipped on the computer device, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory can also include both the internal storage unit of the computer device and its external storage device.
[0065] Embodiment 4
[0066] This embodiment provides a readable storage medium that stores a computer program. The computer program runs on a processor to implement any of the above-mentioned Vue-based front-end page creation methods.
[0067] In this embodiment, a readable storage medium implements any of the above-mentioned Vue-based front-end page creation methods, by generating page function JSON data based on Vue, and selecting a template component and page routing information, the page function JSON data is used to describe the front-end page configuration, the template component is used to parse the page function JSON data, and then by saving the page function JSON data, the configuration information of the template component and the routing information to a persistent database, and then by responding to the front-end site access request, the front-end page is dynamically created without files at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information, so as to realize simple configuration of visual page function JSON data, template components and routing information, improve page production efficiency, persist data to make it editable and publishable, complete fileless page creation at the front-end site, complete front-end page creation online, and save it directly to users, thereby improving front-end page production efficiency and reducing the difficulty of front-end page production.
[0068] It should be noted that the related equipment of the Vue-based front-end page creation method includes but is not limited to the Vue-based front-end page creation device, computer equipment and readable storage medium in the above embodiments.
[0069] It should be pointed out that the above embodiments are only preferred specific implementation modes of the present invention, and the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. The protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A front-end page creation method based on Vue, characterized in that: The following steps are involved: S1. Generate page function JSON data based on Vue, and select template components and page routing information; The page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data; S2. Save the page function JSON data, the configuration information of the template component and the routing information to a persistent database; S3. Respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
2. The Vue-based front-end page creation method according to claim 1, characterized in that: The step S1 comprises the following steps: S10, create an HTML page and introduce a Vue.js file, wherein the Vue.js file includes a js code area; S11, creating a Vue core object in the js code area for data binding; S12. Write a view based on the bound data to generate page function JSON data, and select template components and page routing information.
3. The Vue-based front-end page creation method according to claim 1, characterized in that: The description of the front-end page configuration by the page function JSON data includes: Description of the page control configuration and the button configuration of the front-end page; Description of the table configuration for the front-end page and description of the request configuration for the front-end page.
4. The Vue-based front-end page creation method according to claim 1, characterized in that: The step S2 comprises the following steps: S20, determining the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information; S21, calculating storage space according to the volume of the page function JSON data, the volume of the configuration information of the template component, and the volume of the routing information; S22. According to the calculation result of the storage space, the page function JSON data, the configuration information of the template component and the routing information are saved to a persistent database.
5. The Vue-based front-end page creation method according to claim 1, characterized in that: The persistent database includes a local database and a cloud database; the page function JSON data, the configuration information of the template component and the routing information are saved to the local database and backed up to the persistent database.
6. The Vue-based front-end page creation method according to any one of claims 1 to 5, characterized in that: The step S3 comprises the following steps: S30, responding to the front-end site access request, reading the routing information and dynamically creating a route on the front-end page; S31, reading the page function JSON data, and dynamically parsing the page function JSON data through the template component, so as to dynamically complete the front-end page file-free creation at the front-end site.
7. The Vue-based front-end page creation method according to claim 6, characterized in that: The dynamically parsing the page function JSON data through the template component includes: Dynamically parsing page elements through the template component; The script is dynamically parsed through the template component.
8. The Vue-based front-end page creation method according to claim 7, characterized in that: The dynamic parsing of page elements through template components includes: Dynamically parse controls through template components, and dynamically parse buttons through template components; The table is dynamically parsed through the template component, and the request message is dynamically parsed through the template component.
9. A front-end page creation device based on Vue, characterized in that: include: Data generation selection module, used to generate page function JSON data based on Vue, and select template components and page routing information; The page function JSON data is used to describe the front-end page configuration, and the template component is used to parse the page function JSON data; A data persistence module, used to save the page function JSON data, the configuration information of the template component and the routing information to a persistent database; The front-end page creation module is used to respond to the front-end site access request and dynamically complete the front-end page file-free creation at the front-end site according to the configuration information of the template component, the page function JSON data and the routing information.
10. A computer device, characterized in that: include: A processor, a memory and a computer program; the memory is used to store the computer program; The processor is used to execute a computer program stored in the memory to implement the Vue-based front-end page creation method as described in any one of claims 1-8.
