CN116192718A - vue route configuration method and device - Google Patents

vue route configuration method and device Download PDF

Info

Publication number
CN116192718A
CN116192718A CN202111434041.8A CN202111434041A CN116192718A CN 116192718 A CN116192718 A CN 116192718A CN 202111434041 A CN202111434041 A CN 202111434041A CN 116192718 A CN116192718 A CN 116192718A
Authority
CN
China
Prior art keywords
file
routing
vue
route
target
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
CN202111434041.8A
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.)
Midea Group Co Ltd
GD Midea Air Conditioning Equipment Co Ltd
Original Assignee
Midea Group Co Ltd
GD Midea Air Conditioning Equipment 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 Midea Group Co Ltd, GD Midea Air Conditioning Equipment Co Ltd filed Critical Midea Group Co Ltd
Priority to CN202111434041.8A priority Critical patent/CN116192718A/en
Publication of CN116192718A publication Critical patent/CN116192718A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/14Routing performance; Theoretical aspects
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to the technical field of front-end development and provides a vue route configuration method and device. The method comprises the following steps: monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed; the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template. According to the method and the device for configuring the routing of vue, provided by the invention, the file with the extension name vue is monitored, and under the condition that the file is changed, the script logic of the routing configuration is executed so as to automatically generate the corresponding routing file, so that manual configuration is not needed, the automatic configuration of the routing of vue is realized, a large number of repeated routing configuration works are reduced, and the development efficiency is improved.

Description

vue route configuration method and device
Technical Field
The invention relates to the technical field of front-end development, in particular to a vue route configuration method and device.
Background
The front end is currently largely in the era of mvm (Model-View Model), and essentially all enterprises use the front end framework vue or the react framework to develop the front end requirements. The single page development of vue basically comprises weback engineering+ vue service codes+ vue routing configuration+list page service codes (item needs) + vue components and the like. In the process of list page development facing a large amount of data, repeated manual development is required to configure vue routing, so that development labor cost and bug caused by repeated development are greatly increased.
Therefore, how to propose a method can promote the efficiency of vue route development configuration, realize the automatic configuration of vue routes, and has very important significance.
Disclosure of Invention
The present invention aims to solve at least one of the technical problems existing in the prior art. Therefore, the invention provides a vue route configuration method, which realizes the automatic configuration of vue routes and improves vue route configuration efficiency.
The invention also provides a vue route configuration device.
According to the embodiment of the first aspect of the invention, a target file with an extension name vue under a monitoring target engineering directory is used for executing script logic of route configuration under the condition that the target file is changed; the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
According to the method for configuring the route vue, provided by the embodiment of the invention, the file with the extension of vue is monitored, and under the condition that the file is changed, script logic of route configuration is executed so as to automatically generate the corresponding route file, so that manual configuration is not needed, and the automatic configuration of the route vue is realized. Meanwhile, the automatic route configuration ensures that a developer does not need to pay attention to the route configuration, so that a great amount of repeated route configuration work is reduced, and the development efficiency is improved.
According to one embodiment of the present invention, the script logic for performing routing configuration includes: constructing a Command Line Interface (CLI) tool, and determining a CLI command of the CLI tool and a script logic path of the CLI tool; executing the CLI command to execute the script logic of the route configuration in the script logic path enables automated configuration of vue routes.
According to one embodiment of the present invention, after determining the CLI command of the CLI tool and the script logic path of the CLI tool, the method further includes: the npn link command is executed under the script logic path, linking the CLI command to global through npm module. The command of the CLI is linked to the global through the npm module, so that debugging and testing work in the subsequent development process is facilitated.
According to one embodiment of the present invention, the obtaining routing data according to the file name of the target file and the file path of the target file includes: reading the target file according to the regular matching library, intercepting the file name of the target file and the file path of the target file according to the circulation function and the regular expression, and taking the intercepted obtained file name and the intercepted obtained file path as the routing data, thereby providing a basis for generating a routing file according to a routing template.
According to one embodiment of the present invention, the determining a routing template according to the routing file format of vue includes: the fixed format part in the routing template is determined according to the routing file format of vue, and the file name and the file path in the routing template are determined according to the preset format, so that the generation of a subsequent routing file is facilitated, and a foundation is provided for the subsequent realization of the automatic configuration of vue routes.
According to one embodiment of the present invention, the generating a routing file according to the routing data and the routing template includes: and replacing a preset format of a corresponding position in the routing template by a file name and a file path in the routing data through a JS function to obtain a routing content character string, and inputting the routing content character string into a file system to generate the routing file, so that the automatic generation of the vue routing file is realized, and a foundation is provided for the automatic configuration of vue routing.
According to one embodiment of the present invention, before generating the routing file, the method further includes: and monitoring a routing file under the target engineering directory, and under the condition that the routing file is changed, thermally updating the routing file to the browser according to websocket, so that the real-time updating of the browser interface in the development process is realized, the development process is facilitated, and the development efficiency is improved.
The route configuration module according to the embodiment of the second aspect of the present invention is configured to monitor a target file with an extension name vue under a target engineering catalog, and execute script logic of route configuration when the target file changes;
the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
According to the vue route configuration device provided by the embodiment of the invention, the file with the extension of vue is monitored, and under the condition that the file is changed, script logic of route configuration is executed so as to automatically generate the corresponding route file, so that manual configuration is not needed, and the automatic configuration of vue routes is realized. Meanwhile, the automatic route configuration ensures that a developer does not need to pay attention to the route configuration, so that a great amount of repeated route configuration work is reduced, and the development efficiency is improved.
According to an embodiment of the present invention, there is further provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for configuring vue routing according to any one of the above when the program is executed.
According to an embodiment of the present invention, there is also provided a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of configuring vue routing of any of the above.
According to an embodiment of the present invention, there is also provided a computer program product including a computer program which, when executed by a processor, implements the steps of the method for configuring a vue route as described in any one of the above.
The above technical solutions in the embodiments of the present invention have at least one of the following technical effects:
by monitoring the file with the extension name of vue, script logic of route configuration is executed under the condition that the file is changed, so that a corresponding route file is automatically generated, manual configuration is not needed, and automatic configuration of vue routes is realized. Meanwhile, the automatic route configuration ensures that a developer does not need to pay attention to the route configuration, so that a great amount of repeated route configuration work is reduced, and the development efficiency is improved.
Additional aspects and advantages of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flow chart of a method for configuring a vue route according to an embodiment of the present invention;
fig. 2 is a flow chart of a configuration method of vue route provided by an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a vue routing configuration device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention are described in further detail below with reference to the accompanying drawings and examples. The following examples are illustrative of the invention but are not intended to limit the scope of the invention.
In the description of the embodiments of the present invention, it should be noted that the terms "center", "longitudinal", "lateral", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate orientations or positional relationships based on the orientations or positional relationships shown in the drawings, are merely for convenience in describing the embodiments of the present invention and simplifying the description, and do not indicate or imply that the apparatus or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the embodiments of the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
In describing embodiments of the present invention, it should be noted that, unless explicitly stated and limited otherwise, the terms "coupled," "coupled," and "connected" should be construed broadly, and may be either a fixed connection, a removable connection, or an integral connection, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium. The specific meaning of the above terms in embodiments of the present invention will be understood in detail by those of ordinary skill in the art.
In embodiments of the invention, unless expressly specified and limited otherwise, a first feature "up" or "down" on a second feature may be that the first and second features are in direct contact, or that the first and second features are in indirect contact via an intervening medium. Moreover, a first feature being "above," "over" and "on" a second feature may be a first feature being directly above or obliquely above the second feature, or simply indicating that the first feature is level higher than the second feature. The first feature being "under", "below" and "beneath" the second feature may be the first feature being directly under or obliquely below the second feature, or simply indicating that the first feature is less level than the second feature.
In the description of the present specification, a description referring to terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the embodiments of the present invention. In this specification, schematic representations of the above terms are not necessarily directed to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, the different embodiments or examples described in this specification and the features of the different embodiments or examples may be combined and combined by those skilled in the art without contradiction.
Fig. 1 is a flow chart of a configuration method of a vue route according to an embodiment of the present invention. Referring to fig. 1, a method for configuring a vue route according to an embodiment of the present invention may include:
110. monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed;
the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
The execution subject of the vue routing configuration method provided by the embodiment of the invention can be electronic equipment, a component in the electronic equipment, an integrated circuit or a chip. The electronic device may be a mobile electronic device or a non-mobile electronic device. By way of example, the mobile electronic device may be a cell phone, tablet, notebook, palm, wearable device, ultra mobile personal computer (ultra-mobile personal computer, UMPC), netbook or personal digital assistant (personal digital assistant, PDA), etc., and the non-mobile electronic device may be a server, network attached storage (Network Attached Storage, NAS) or personal computer (personal computer, PC), etc., the invention is not limited in particular.
The following describes the technical scheme of the present invention in detail by taking a computer to execute the configuration method of vue route provided in the embodiment of the present invention as an example.
In step 110, a target file with an extension vue under the target engineering catalog is monitored, and script logic of route configuration is executed under the condition that the target file is changed.
Specifically, the target engineering catalog is the engineering catalog of vue project, and the target file with the extension vue is the file with the format of. vue. The vue file in the engineering catalog in the currently developed vue project is snooped. When the target file of vue is monitored to be changed, script logic of pre-defined route configuration is executed, and a route file corresponding to the target file of vue is generated, so that automatic route configuration is realized.
Optionally, the target file with the monitoring extension vue changes, wherein the specific changes may be the new addition, modification, update, deletion, etc. of the file vue.
It will be appreciated that the vue target file in the target project directory is listened to. In the monitoring process, once the vue target file in the target engineering catalog is determined to be changed, for example, a new vue file is added or an original vue file is deleted, the script logic of the route configuration is executed according to the script logic of the corresponding route configuration, so that the route file can be automatically updated. Under the condition of facing a large number of routes needing to be configured vue, a large number of repeated works are reduced, the workload is lightened, and the development cost is reduced.
The script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
Specifically, the update of the routing file is realized by constructing the routing template. The routing templates are determined in advance from the generic routing file format of vue based on the build routing templates. The file name and file path of the changed vue destination file are obtained as routing data. And combining the routing data with the routing template to generate a corresponding routing file.
It can be understood that constructing the routing template can simplify the generation mode of the routing file, and after obtaining the necessary routing data in the template, the routing file is generated by combining according to the fixed format data part in the template. By means of the template construction mode, the efficiency of route configuration is improved.
According to the method for configuring the vue route, provided by the embodiment of the invention, the file with the extension name vue is monitored, and under the condition that the file is changed, script logic of route configuration is executed so as to automatically generate the corresponding route file, manual configuration is not needed, and automatic configuration of the vue route is realized. Meanwhile, the automatic route configuration ensures that a developer does not need to pay attention to the route configuration, so that a great amount of repeated route configuration work is reduced, and the development efficiency is improved.
In one embodiment, script logic to perform routing configuration includes: constructing a CLI (Command-Line Interface) tool, and determining a CLI Command of the CLI tool and a script logic path of the CLI tool; the CLI command is executed to execute the scripting logic of the routing configuration in the scripting logic path.
Optionally, a CLI tool is constructed under item vue, the name of the CLI command and the script logic path can be confirmed in a package. When the target engineering project is started, the execution service of script logic of a route configuration is started by executing the CLI command, and after the change of the vue file under the target engineering project is monitored, the script logic of the corresponding route configuration is automatically executed according to the execution service.
According to the method for configuring the vue route, provided by the embodiment of the invention, the CLI tool is constructed, and the automatic configuration of the vue route is realized according to the script logic for executing the routing configuration in the script logic path by executing the CLI command.
In one embodiment, after determining the CLI command and the script logic path of the CLI tool, further comprising: the npn link command is executed under the script logic path, linking the CLI command to global through npm module.
Specifically, after the CLI tool is constructed, the link command is executed under the path of the script logic, so that connection is established between the constructed CLI tool item and the local nmp module, the CLI command is changed into a global command, and the debugging and testing in the subsequent development process are facilitated.
According to the configuration method of the vue route, provided by the embodiment of the invention, the npm link command is executed under the script logic path, and the CLI command is linked to the global through the npm module, so that debugging and testing work in the subsequent development process are facilitated.
In one embodiment, obtaining routing data according to a file name of a target file and a file path of the target file includes: reading the target file according to the regular matching library, intercepting the file name of the target file and the file path of the target file according to the round robin function and the regular expression, and taking the intercepted obtained file name and the intercepted obtained file path as routing data.
Optionally, after the change of the target file of vue is monitored, the corresponding target file of vue under the target engineering catalog is read through the regular matching library glob, and the file name and the file path array object are intercepted through the circulation function and the regular expression to serve as the routing data.
According to the configuration method of the vue route, provided by the embodiment of the invention, the file name of the file and the file path of the file are intercepted according to the circulation function and the regular expression, and the intercepted file name and the intercepted file path are taken as the route data, so that a foundation is provided for generating the route file according to the route template.
In one embodiment, determining the routing template from the routing file format of vue includes: the fixed format part in the routing template is determined according to the routing file format of vue, and the file name and the file path in the routing template are determined according to the preset format.
Optionally, in the process of writing the routing template, the routing template is written through the routing file format of vue. The dynamic data and the functions in the routing template are respectively determined by a preset format, namely written by a specific symbol format. Dynamic data refers to dynamically changing parts of the template, such as file names and file paths of the vue file. A function refers to a portion of a template that is converted by a function, such as in the vue file, where the processing of the file name may be by a processing function into a particular format.
According to the configuration method of the vue route, the fixed format part in the routing template is determined according to the vue route file format, and the file name and the file path in the routing template are determined according to the preset format, so that the determination of the routing template is finally realized, the generation of subsequent routing files is facilitated, and a foundation is provided for the subsequent realization of the automated configuration of vue routes.
In one embodiment, generating a routing file from routing data and a routing template includes: and replacing a preset format of a corresponding position in the routing template by a file name and a file path in the routing data through the JS function to obtain a routing content character string, and inputting the routing content character string into a file system to generate the routing file.
Specifically, after the routing data is determined and the routing templates are built. The routing file may be generated based on the determined routing data and the routing template. And replacing the file name and the file path in the obtained routing data with the corresponding parts in the template through a function in JavaScript to obtain a routing content character string, and finally dynamically generating the routing file through a file system by the content character string.
According to the configuration method of the vue route, provided by the embodiment of the invention, the file name and the file path in the route data are replaced by the JS function, the preset format of the corresponding position in the route template is replaced, the route content character string is obtained, the route content character string is input into the file system to generate the route file, the automatic generation of the vue route file is realized, and a foundation is provided for the automatic configuration of the vue route.
In one embodiment, before generating the routing file, the method further includes: and monitoring a routing file under the target engineering directory, and under the condition that the routing file is changed, thermally updating the routing file to a browser according to websocket.
In the development process, the websocket hot update is to repackage the codes after the codes are modified and stored, and send the packed new modules to the browser end, and the browser replaces the old modules by the new modules, so that the application can be updated on the premise of not refreshing the browser.
Optionally, starting the vue devServer server in the process of developing the target engineering project. The route file is monitored through the vue devServer server, and the browser is updated to the browser through websocket heat under the condition that the route file is monitored to change, so that the real-time update of the browser interface in the development process is realized, and the browser does not need to be refreshed.
According to the configuration method of the vue route, the route file under the target engineering directory is monitored, and under the condition that the route file is changed, the route file is updated to the browser according to websocket. The browser interface is updated in real time in the development process, so that the development process is facilitated, and the development efficiency is improved.
The following describes a technical solution provided by the embodiment of the present invention, taking a flowchart of a configuration method of vue route provided by the embodiment of the present invention as an example fig. 2:
CLI tools were built under item vue. Firstly, confirming the name and script path of a CLI command in a package. Json under a target project of vue, then compiling script logic of route configuration, finally executing npm link under the project to link the CLI command to the global, and simultaneously starting hot update by an integrated vue devServer development server;
monitoring a target engineering catalog and starting a vue devServer server;
vue files under the target engineering directory are continuously monitored, if the target engineering directory is changed, script logic of route configuration is executed to generate a route file;
script logic to perform the routing configuration is: the vue file under the specific directory is synchronously read through regular matching, a corresponding path array is obtained, and a file name and a file path array object are intercepted through a round robin function and a regular expression to serve as routing data; writing a routing file in a vue format, wherein dynamic data and functions are respectively written in a specific symbol format, and a routing template is generated; reading the content in the template according to the obtained route data and the constructed route template and combining with a file system, obtaining a route content character string through JS function processing, and finally dynamically generating a route file through the file system by the route content character string;
the vue devServer monitors the route configuration to change, after generating the route file, the route file is compiled and packaged again as required, and the route file is updated to the browser through websocket heat, so that the real-time updating of the browsing content is realized, and the browser does not need to be refreshed.
The embodiment of the invention also provides a vue route configuration device which can be correspondingly referred to the vue route configuration method.
Fig. 3 is a schematic structural diagram of a vue routing configuration device according to an embodiment of the present invention, where, as shown in fig. 3, the device includes:
the route configuration module 310 is configured to monitor a target file with an extension name vue under a target engineering catalog, and execute script logic of route configuration under the condition that the target file changes;
the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
According to the configuration device of the vue route, provided by the embodiment of the invention, the file with the extension name vue is monitored, and under the condition that the file is changed, script logic of route configuration is executed so as to automatically generate the corresponding route file, manual configuration is not needed, and automatic configuration of the vue route is realized. Meanwhile, the automatic route configuration ensures that a developer does not need to pay attention to the route configuration, so that a great amount of repeated route configuration work is reduced, and the development efficiency is improved.
In one embodiment, the route configuration module 310 is specifically configured to:
constructing a Command Line Interface (CLI) tool, and determining a CLI command of the CLI tool and a script logic path of the CLI tool;
executing the CLI command to execute the script logic of the routing configuration in the script logic path.
In one embodiment, the route configuration module 310 is further specifically configured to:
the npn link command is executed under the script logic path, linking the CLI command to global through npm module.
In one embodiment, the route configuration module 310 is further specifically configured to:
and reading the target file according to the regular matching library, intercepting the file name of the target file and the file path of the target file according to a circulation function and a regular expression, and taking the intercepted obtained file name and the intercepted obtained file path as the routing data.
In one embodiment, the route configuration module 310 is further specifically configured to:
the fixed format part in the routing template is determined according to the routing file format of vue, and the file name and the file path in the routing template are determined according to the preset format.
In one embodiment, the route configuration module 310 is further specifically configured to:
and replacing a preset format of a corresponding position in the routing template by a file name and a file path in the routing data through a JS function to obtain a routing content character string, and inputting the routing content character string into a file system to generate the routing file.
In one embodiment, the route configuration module 310 is further specifically configured to:
and monitoring a routing file under the target engineering directory, and under the condition that the routing file is changed, thermally updating the routing file to a browser according to websocket.
Fig. 4 illustrates a physical schematic diagram of an electronic device, as shown in fig. 4, which may include: processor 410, communication interface (Communications Interface) 420, memory 430 and communication bus 440, wherein processor 410, communication interface 420 and memory 430 communicate with each other via communication bus 440. The processor 410 may call logic instructions in the memory 430 to perform the following method: monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed; the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
Further, the logic instructions in the memory 430 described above may be implemented in the form of software functional units and may be stored in a computer-readable storage medium when sold or used as a stand-alone product. Based on this understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
Further, embodiments of the present invention disclose a computer program product comprising a computer program stored on a non-transitory computer readable storage medium, the computer program comprising program instructions which, when executed by a computer, enable the computer to perform the methods provided by the above-described method embodiments, for example comprising: monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed; the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
In another aspect, embodiments of the present invention further provide a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor is implemented to perform the transmission method provided in the above embodiments, for example, including: monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed; the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
The apparatus embodiments described above are merely illustrative, wherein the elements illustrated as separate elements may or may not be physically separate, and the elements shown as elements may or may not be physical elements, may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art will understand and implement the present invention without undue burden.
From the above description of the embodiments, it will be apparent to those skilled in the art that the embodiments may be implemented by means of software plus necessary general hardware platforms, or of course may be implemented by means of hardware. Based on this understanding, the foregoing technical solution may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as ROM/RAM, a magnetic disk, an optical disk, etc., including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the respective embodiments or some parts of the embodiments.
Finally, it should be noted that: the above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
The above embodiments are only for illustrating the present invention, and are not limiting of the present invention. While the invention has been described in detail with reference to the embodiments, those skilled in the art will appreciate that various combinations, modifications, or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention, and it is intended to be covered by the scope of the claims of the present invention.

Claims (11)

1. A method for configuring a vue route, comprising:
monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed;
the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
2. The method of claim 1, wherein the script logic for performing route configuration comprises:
constructing a Command Line Interface (CLI) tool, and determining a CLI command of the CLI tool and a script logic path of the CLI tool;
executing the CLI command to execute the script logic of the routing configuration in the script logic path.
3. The method for vue routing as recited in claim 2 wherein after determining the CLI command of the CLI tool and the script logic path of the CLI tool, further comprising:
the npmlink command is executed under the script logic path, and the CLI command is linked to global through npm module.
4. The method for configuring a vue route according to claim 1, wherein said obtaining route data according to the file name of the target file and the file path of the target file comprises:
and reading the target file according to the regular matching library, intercepting the file name of the target file and the file path of the target file according to a circulation function and a regular expression, and taking the intercepted obtained file name and the intercepted obtained file path as the routing data.
5. The method of claim 1, wherein the determining a routing template according to the routing file format of vue, comprises:
the fixed format part in the routing template is determined according to the routing file format of vue, and the file name and the file path in the routing template are determined according to the preset format.
6. The method for configuring a vue route according to claim 5, wherein generating a routing file according to the routing data and the routing template comprises:
and replacing a preset format of a corresponding position in the routing template by a file name and a file path in the routing data through a JS function to obtain a routing content character string, and inputting the routing content character string into a file system to generate the routing file.
7. The method for configuring a vue route according to claim 1, further comprising, before generating the route file:
and monitoring a routing file under the target engineering directory, and under the condition that the routing file is changed, thermally updating the routing file to a browser according to websocket.
8. A vue routed configuration apparatus, comprising:
the route configuration module is used for monitoring a target file with an extension name vue under a target engineering catalog, and executing script logic of route configuration under the condition that the target file is changed;
the script logic of the route configuration comprises: acquiring route data according to the file name of the target file and the file path of the target file; determining a routing template according to the routing file format of the front end framework vue; and generating a routing file according to the routing data and the routing template.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor performs the steps of the method of configuring a vue route as claimed in any one of claims 1 to 7 when the program is executed.
10. A non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor, performs the steps of the method of configuring a vue route as claimed in any one of claims 1 to 7.
11. A computer program product comprising a computer program which when executed by a processor performs the steps of the method of configuring a vue route as claimed in any one of claims 1 to 7.
CN202111434041.8A 2021-11-29 2021-11-29 vue route configuration method and device Pending CN116192718A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111434041.8A CN116192718A (en) 2021-11-29 2021-11-29 vue route configuration method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111434041.8A CN116192718A (en) 2021-11-29 2021-11-29 vue route configuration method and device

Publications (1)

Publication Number Publication Date
CN116192718A true CN116192718A (en) 2023-05-30

Family

ID=86449520

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111434041.8A Pending CN116192718A (en) 2021-11-29 2021-11-29 vue route configuration method and device

Country Status (1)

Country Link
CN (1) CN116192718A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112021A (en) * 2023-10-24 2023-11-24 腾讯科技(深圳)有限公司 Route configuration generation method, device, equipment and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117112021A (en) * 2023-10-24 2023-11-24 腾讯科技(深圳)有限公司 Route configuration generation method, device, equipment and computer readable storage medium
CN117112021B (en) * 2023-10-24 2024-01-26 腾讯科技(深圳)有限公司 Route configuration generation method, device, equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN108293081B (en) Deep linking of program playback to mobile application state through user interface events
TW201915850A (en) Method for generating application program, apparatus, system, device, and medium
CN106445518A (en) Method and system for developing cross-platform mobile terminal application
CN109002366A (en) A kind of remote debugging method and device of mobile terminal webpage
US11768755B2 (en) Graph analysis and database for aggregated distributed trace flows
CN113722020B (en) Interface calling method, device and computer readable storage medium
CN113778848A (en) Test code generation method, device, computer system and medium
CN113127361B (en) Application development method and device, electronic equipment and storage medium
CN107688529A (en) Component adjustment method and device
CN112732572A (en) Service testing method, device and system, storage medium and electronic device
US10025562B2 (en) Collaborative development of a web-based service
CN103634393A (en) IVR (interactive voice response) and realization method thereof
CN107395747A (en) A kind of high extended method based on STF platforms
CN104850498A (en) Filling information testing method and filling information testing system
CN112860247A (en) Custom generation method, device, equipment and medium for model component
CN113268243A (en) Memory prediction method and device, storage medium and electronic equipment
CN116192718A (en) vue route configuration method and device
CN111694550A (en) Page display control method, device and system
CN108241499A (en) Method and device for updating field value annotation and computer readable storage medium
CN110704099B (en) Alliance chain construction method and device and electronic equipment
WO2017076244A1 (en) Method, device and related system for dynamically repairing application
CN114356763A (en) H5 page local debugging method suitable for hybrid App
CN114328180A (en) Interface automation test method, system, electronic equipment and storage medium
CN113128187B (en) Form generation method, device and system
CN117235107B (en) Data access processing method and device, electronic equipment and storage 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