CN113268260A - Routing method and device for web front end - Google Patents

Routing method and device for web front end Download PDF

Info

Publication number
CN113268260A
CN113268260A CN202110633220.8A CN202110633220A CN113268260A CN 113268260 A CN113268260 A CN 113268260A CN 202110633220 A CN202110633220 A CN 202110633220A CN 113268260 A CN113268260 A CN 113268260A
Authority
CN
China
Prior art keywords
routing
web
page
file
path information
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
CN202110633220.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.)
Jingdong Technology Holding Co Ltd
Original Assignee
Jingdong Technology Holding 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 Jingdong Technology Holding Co Ltd filed Critical Jingdong Technology Holding Co Ltd
Priority to CN202110633220.8A priority Critical patent/CN113268260A/en
Publication of CN113268260A publication Critical patent/CN113268260A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Abstract

The invention provides a routing method and a device for a web front end, wherein the method comprises the following steps: acquiring a new file at the front end of the web; generating routing path information of each page based on the web front end new file; generating a routing name corresponding to each page based on a preset rule; and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name. Automatically generating routing path information of each page by utilizing a new file based on a web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.

Description

Routing method and device for web front end
Technical Field
The invention relates to the technical field of computers, in particular to a routing method and a routing device for a web front end.
Background
In the process of web (website) front-end development, there are some repetitive works and parts which need to manually comply with the specifications, such as generation of routing configuration files, currently, when a web front-end development is performed, when a page is newly built, a corresponding route needs to be added in the routing configuration files, when a project is huge, the maintenance cost of the routing configuration files is large, and the route depends on hard coding of a routing object, when a certain route changes, the corresponding routing object needs to be modified. When the routing hierarchy, path changes, it may even be faced with rewriting the entire routing object array. In addition, when a plurality of persons develop cooperatively, the routing naming is manually obeyed the specification constraint, and the condition that the routing naming is not standard enough often occurs.
Therefore, how to provide a routing scheme for a web front end can reduce routing work of technicians in a web front-end development process, and standardizing routing names is a technical problem to be solved by the technicians in the field.
Disclosure of Invention
The invention provides a routing scheme for a web front end, which can reduce the routing work of technicians in the process of developing the front section of the web and standardize the routing name.
In a first aspect, the present invention provides a routing method for a web front end, including:
acquiring a new file at the front end of the web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
Further, the acquiring a new file at a front end of the web includes:
and acquiring the component file and the routing meta-information file.
Further, the generating of the routing path information of each page based on the new file at the front end of the web includes:
taking a root component in the component file as a frame component of each page;
analyzing the page structure of each page in the routing meta-information file;
and generating routing path information corresponding to each page based on the page structure.
Further, the generating a route name corresponding to each page based on a preset rule includes:
acquiring routing path information corresponding to each page;
and adding preset identifiers among directory levels in the routing path information to generate routing names corresponding to the pages.
Further, after configuring the routing configuration file corresponding to each page based on the routing path information and the corresponding routing name, the method further includes:
detecting whether the new file at the front end of the web changes in real time;
under the condition that the web front end new file changes, generating current routing path information of each page based on the current web front end new file;
the routing configuration file is updated based on the current routing path information.
Further, before the detecting whether the new file at the front end of the web changes in real time, the method further includes:
receiving the conversion input of a user to the current working state;
under the condition that the current working state is the using state, stopping detecting whether the new file at the front end of the web changes in real time;
and under the condition that the current working state is a debugging state, detecting whether the new file at the front end of the web changes in real time.
In a second aspect, the present invention provides a routing apparatus for a web front end, comprising:
the file acquisition module is used for acquiring a new file at the front end of the web;
the path generating module is used for generating routing path information of each page based on the web front end new file;
the name generation module is used for generating a routing name corresponding to each page based on a preset rule;
and the routing configuration module is used for configuring the routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
Further, the file acquisition module comprises:
and the two file acquisition units are used for acquiring the component files and the routing meta information files.
Further, the path generation module includes:
a first unit, configured to use a root component in the component file as a frame component of each page;
the second unit is used for analyzing the page structure of each page in the routing meta-information file;
and the third unit is used for generating the routing path information corresponding to each page based on the page structure.
Further, the route configuration module includes:
a path obtaining unit, configured to obtain routing path information corresponding to each page;
and the name generation unit is used for adding preset identifiers among directory hierarchies in the routing path information and generating routing names corresponding to the pages.
Further, still include:
the change detection module is used for detecting whether the new file at the front end of the web changes in real time;
the path updating module is used for generating current routing path information of each page based on the current web front end new file under the condition that the web front end new file changes;
and the configuration file updating module is used for updating the routing configuration file based on the current routing path information.
Further, still include:
the input receiving module is used for receiving the conversion input of a user to the current working state;
the first response module is used for stopping detecting whether the new file at the front end of the web changes in real time under the condition that the current working state is the using state;
and the second response module is used for detecting whether the new file at the front end of the web changes in real time under the condition that the current working state is the debugging state.
In a third aspect, the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the steps of the routing method for a web front end as described in any one of the above are implemented.
In a fourth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the routing method for a web front end as described in any of the above.
The invention provides a routing method and a device for a web front end, which automatically generate routing path information of each page by utilizing a new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a routing method for a web front end according to an embodiment of the present invention;
fig. 2 is a second flowchart of a routing method for a web front end according to an embodiment of the present invention;
fig. 3 is a third schematic flowchart of a routing method for a web front end according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a routing apparatus for a web front end according to an embodiment of the present invention;
fig. 5 is a schematic usage diagram of a routing apparatus for a web front end according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a hardware structure of another electronic device for implementing an embodiment of the invention
Fig. 7 is a schematic structural diagram of another electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms first, second and the like in the description and in the claims of the present invention are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that embodiments of the invention may be practiced otherwise than as specifically illustrated and described herein. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
A routing method for a web front end of the present invention is described below in conjunction with fig. 1-3.
Fig. 1 is a schematic flowchart of a routing method for a web front end according to an embodiment of the present invention; fig. 2 is a second flowchart of a routing method for a web front end according to an embodiment of the present invention; fig. 3 is a third flowchart illustrating a routing method for a web front end according to an embodiment of the present invention.
In a first aspect, an embodiment of the present invention provides a routing method for a web front end, including:
step 110: acquiring a new file at the front end of the web;
in Web page development of a Web front end, component files need to be newly created, for example, using Vue front end framework, and vue.js is a library for constructing an interactive Web Interface, which provides MVVM (Model-View Model) data binding and a combinable component system with simple and flexible API (Application Program Interface). Firstly, a component file hello-word. Component files and routing meta information files.
Step 120: generating routing path information of each page based on the web front end new file;
after a technician creates a new file at the web front end of a page, routing information is automatically generated according to the directory hierarchy and the page structure of the page. For example, in practice, the root component in the component file may be used as the frame component for each page; analyzing the page structure of each page in the routing meta-information file; and generating routing path information corresponding to each page based on the page structure.
Step 130: generating a routing name corresponding to each page based on a preset rule;
in an embodiment, specifically, a routing name may be determined according to routing path information, and specifically, routing path information corresponding to each page may be first obtained; and adding preset identifiers among directory levels in the routing path information to generate routing names corresponding to the pages. For example, in practice, if the routing path is cms/page/manager, the routing name corresponding to the routing path may be named as: the cms-page-name may also use other characters, or may not use a preset identifier, and directly use the cmspagename as a route name, where how to automatically generate the route name is not limited, but is only a possible automatic route name manner.
Step 140: and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
After the routing path information and the corresponding routing name of each page are obtained, the routing configuration file can be configured, and in the specific configuration process, not only the routing path and the routing name but also other additional contents are required to be added into the routing configuration file.
Specifically, in the process of web development, the use of a route is indispensable and represents a mapping relationship between a url (web page link) and a corresponding processing program, after a user inputs the url to be accessed, the route analyzes a path in the url, then a corresponding preset function is searched according to the mapping relationship in the mapping table, and a result is returned to the user, so that one operation is completed.
The front-end routing is different from the traditional routing, and does not need a server for resolution, but is realized by a hash function or history API (history interface) provided by H5(HTML5 webpage). When a user accesses the corresponding path, the routing realizes switching among different components according to the mapping relation, the whole process is realized in the same page, and the skipping among the pages is not involved, namely the single-page application which is often called.
The page refreshing speed of the front-end route is high. The back-end routing sends the request to the server again when requesting a new path, and then re-renders the page according to the corresponding result of the server, the process is influenced by network delay, the front-end routing omits the whole request process and only completes the switching among partial components, so the page refreshing speed is relatively high, and the user experience is relatively good. And the reusability is strong. By using front-end routing, layout, css and js in the code can be shared, so that repeated loading is reduced, and program performance is provided. And the page status may be recorded. The front-end routing is not used, only single-page application of page local switching is carried out through ajax, the url is always kept unchanged, so that the state of the page cannot be recorded, and the front-end routing well solves the problem. For example, url using front-end routing: http:// music. taihe. com/fe/a link, which is opened again will directly trigger the event of/a. Front-end routing has been widely used in web development due to its fast refresh rate and good user experience, and many large front-end frameworks, such as vue, have their own front-end routing.
The routing method for the web front end provided by the embodiment of the invention automatically generates the routing path information of each page by utilizing a new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
Specifically, in an embodiment, the page opening permission process, whether a page can be opened, is determined by: a determination to determine whether to increase login, a) True: entering a process of judging whether login exists; b) false: directly opening a page; whether login is successful or failed can be judged according to login judgment; a) judging whether the user logs in or not, and entering a page if the user logs in; b) judging whether the user logs in or not, and entering a login page if the user does not log in;
of course, in an embodiment, the routing meta information file meta.json may also be configured, so as to implement more functions. For example, the following parameters may be configured in meta.
"name": you custom name,// name is a built-in attribute, and optionally, may override the default generated route name, that is, if the name parameter already exists in meta.
"Path": a/: b "// built-in attributes, not necessary, may be used to support path parameters such as: a/page 1/: a/: b, and a parameter this. $ route. That is, when generating the routing path information, the built-in attribute parameter can be referred to, so that the routing path information can be generated more accurately.
"redirect" - "default-child" -// built-in attribute, optionally, the parent page can set redirect to define default child pages; that is, the built-in attribute parameters may be for each page
"menu" {// custom example, if there is no need to show on the main interface menu, then the menu item is not configured:
title 'kanban',
"icon":"el-icon-s-help"
},
1,// built-in attributes, not necessary, for intervening in the order of page route generation;
"layout Components" @/Components/[ other-layout-components ] ",// built-in properties, optionally, manually changing the container component corresponding to the page, typically without configuration
"Access [// custom permissions, e.g. for page permission definitions: specifically, the rights are classified as follows:
"ADMIN", that is, administrator authority;
"USER VISITOR", i.e., VISITOR USER rights;
"GUEST", GUEST permissions;
"VISITOR rights.
In another embodiment of the present invention, in practice, after the web front-end web page is created, there is a case where the web front-end web page is modified, and at this time, in order to update the routing configuration file timely, the following steps may be performed:
step 210: detecting whether the new file at the front end of the web changes in real time;
in the embodiment of the present invention, the specific content of the web front end new file may be detected, and the current specific content may be compared with the previous history specific content, so as to detect whether the web front end new file changes, and certainly, other information may be used to detect whether the web front end new file changes, for example, the size attribute of the file, the saving time, and the like may be used to determine whether the web front end new file changes.
Step 220: under the condition that the web front end new file changes, generating current routing path information of each page based on the current web front end new file;
after the new file at the front end of the web changes, the current routing path information of each page needs to be generated for the new file at the front end of the web, and of course, the new naming for the routing name may need to be newly generated.
Step 230: the routing configuration file is updated based on the current routing path information.
And after the current routing path information is obtained, updating the routing configuration file. In practice, each page is adopted to correspond to a routing configuration file, so that after one page is changed, the corresponding routing configuration file only needs to be updated, and all routing configuration files do not need to be updated.
Certainly, a switch in a working state may also be provided, so as to turn on and off the detection of the new file at the web front end, and avoid that the detection of the new file at the web front end is always performed, which wastes interfaces and computing resources, and specifically, the following steps may be performed:
step 310: receiving the conversion input of a user to the current working state;
for example, a user may see, on the current work interface, whether the current work state is a use state or a debug state, where the use state indicates that the system has been put into use, and at this time, each page cannot be adjusted, that is, the routing configuration file does not need to be updated, and when the work state is the debug state, it is described that the content of the web page may be changed, and at this time, the routing configuration file may be updated.
Specifically, a button for receiving a click input of the user may be provided, and the current operating state may be displayed, and when the user clicks the button, the operating state may be switched.
Step 320: under the condition that the current working state is the using state, stopping detecting whether the new file at the front end of the web changes in real time;
and when the current working state is adjusted by a user and the current working state is the using state, stopping detecting whether the new file at the front end of the web changes in real time, and not updating the routing configuration file.
Step 330: and under the condition that the current working state is a debugging state, detecting whether the new file at the front end of the web changes in real time.
Detecting whether the new file at the web front end changes in real time under the condition that the current working state is a debugging state, and generating current routing path information of each page based on the current new file at the web front end under the condition that the new file at the web front end changes; after the new file at the front end of the web changes, the current routing path information of each page needs to be generated for the new file at the front end of the web, and of course, the new naming for the routing name may need to be newly generated. And updating the route configuration file after obtaining the current route path information. In practice, each page is adopted to correspond to a routing configuration file, so that after one page is changed, the corresponding routing configuration file only needs to be updated, and all routing configuration files do not need to be updated.
The embodiment of the invention provides a routing method for a web front end, which automatically generates routing path information of each page by utilizing a new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
The following describes the routing apparatus for web front end provided by the present invention, and the routing apparatus for web front end described below and the routing method for web front end described above may be referred to correspondingly.
Referring to fig. 4, fig. 4 is a schematic structural diagram of a routing device for a web front end according to an embodiment of the present invention; fig. 5 is a schematic usage diagram of a routing apparatus for a web front end according to an embodiment of the present invention.
In another specific implementation manner of the present invention, an embodiment of the present invention provides a routing apparatus 400 for a web front end, including:
the file acquiring module 410 is used for acquiring a new file at the front end of the web;
the path generating module 420 is configured to generate routing path information of each page based on the web front-end new file;
a name generating module 430, configured to generate a routing name corresponding to each page based on a preset rule;
a routing configuration module 440, configured to configure a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
The embodiment of the invention provides a routing device for a web front end, which automatically generates routing path information of each page by utilizing a new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
In one embodiment, the file acquisition module includes:
and the two file acquisition units are used for acquiring the component files and the routing meta information files.
In one embodiment, the path generation module comprises:
a first unit, configured to use a root component in the component file as a frame component of each page;
the second unit is used for analyzing the page structure of each page in the routing meta-information file;
and the third unit is used for generating the routing path information corresponding to each page based on the page structure.
In one embodiment, the route configuration module comprises:
a path obtaining unit, configured to obtain routing path information corresponding to each page;
and the name generation unit is used for adding preset identifiers among directory hierarchies in the routing path information and generating routing names corresponding to the pages.
In one embodiment, further comprising:
the change detection module is used for detecting whether the new file at the front end of the web changes in real time;
the path updating module is used for generating current routing path information of each page based on the current web front end new file under the condition that the web front end new file changes;
and the configuration file updating module is used for updating the routing configuration file based on the current routing path information.
In one embodiment, further comprising:
the input receiving module is used for receiving the conversion input of a user to the current working state;
the first response module is used for stopping detecting whether the new file at the front end of the web changes in real time under the condition that the current working state is the using state;
and the second response module is used for detecting whether the new file at the front end of the web changes in real time under the condition that the current working state is the debugging state.
Referring to fig. 5, as shown in fig. 5, when a new page is developed, a component file, a hello-word file, and a meta-json file need to be newly created, and after obtaining information in these newly created files, the routing device automatically generates a routing configuration information file to automatically correspond to a routing name, so that a developer does not need to pay attention to how to maintain the routing configuration file. When a page route is really modified by development, only the name of the component file needs to be modified, the routing device automatically updates the routing configuration information after detecting the change of the name of the component file, the file automatically corresponds to the routing name, and a developer does not need to pay attention to how to maintain the routing configuration file. In the specific use process, the routing device can be designed into a plug-in, so that the routing device can be conveniently added to a development software system at the front section of the web.
The embodiment of the invention provides a routing device for a web front end, which automatically generates routing path information of each page by utilizing a new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
The routing device for the web front end in the embodiment of the present invention may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiment of the present invention is not particularly limited.
The routing device for the web front end in the embodiment of the present invention may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present invention are not limited in particular.
The routing device for the web front end according to the embodiment of the present invention can implement each process implemented by the routing method for the web front end according to the method embodiments in fig. 1 to fig. 3, and is not described herein again to avoid repetition.
Fig. 6 is a schematic diagram of a hardware structure of another electronic device for implementing the embodiment of the present invention.
The electronic device 600 includes, but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 606, an interface unit 608, a memory 609, a processor 610, and the like.
Those skilled in the art will appreciate that the electronic device 600 may further comprise a power source (e.g., a battery) for supplying power to the various components, and the power source may be logically connected to the processor 610 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 6 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 610 is configured to obtain a new file at a front end of a web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
In one embodiment, the processor 610 is configured to obtain a component file and a routing meta information file.
In one embodiment, the processor 610 is configured to:
taking a root component in the component file as a frame component of each page;
analyzing the page structure of each page in the routing meta-information file;
and generating routing path information corresponding to each page based on the page structure.
In one embodiment, the processor 610 is configured to:
acquiring routing path information corresponding to each page;
and adding preset identifiers among directory levels in the routing path information to generate routing names corresponding to the pages.
In one embodiment, the processor 610 is configured to:
detecting whether the new file at the front end of the web changes in real time;
under the condition that the web front end new file changes, generating current routing path information of each page based on the current web front end new file;
the routing configuration file is updated based on the current routing path information.
In one embodiment, the processor 610 is configured to:
receiving the conversion input of a user to the current working state;
under the condition that the current working state is the using state, stopping detecting whether the new file at the front end of the web changes in real time;
and under the condition that the current working state is a debugging state, detecting whether the new file at the front end of the web changes in real time.
According to the electronic device provided by the embodiment of the invention, the routing path information of each page is automatically generated by utilizing the new file based on the web front end; generating a routing name corresponding to each page based on a preset rule; therefore, the routing path and the routing name of the finally obtained routing configuration file are automatically generated, technical personnel do not need to interfere with the routing path and the routing name, the routing work of the technical personnel in the web front-segment development process can be reduced, and the naming of the routing name is standardized.
The embodiment of the present invention further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to execute a program or an instruction to implement each process of the routing method for a web front end, and the same technical effect can be achieved, and in order to avoid repetition, details are not repeated here.
Fig. 7 illustrates a physical structure diagram of an electronic device, and as shown in fig. 7, the electronic device may include: a processor (processor)710, a communication Interface (Communications Interface)720, a memory (memory)730, and a communication bus 740, wherein the processor 710, the communication Interface 720, and the memory 730 communicate with each other via the communication bus 740. Processor 710 may invoke logic instructions in memory 730 to perform a routing method for a web front end, the method comprising:
acquiring a new file at the front end of the web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
In addition, the logic instructions in the memory 730 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides 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 routing method for a web front end provided by the above methods, the method comprising: acquiring a new file at the front end of the web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
In yet another aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program, which when executed by a processor is implemented to perform the routing method for a web front end provided in each of the above, the method comprising:
acquiring a new file at the front end of the web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present 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 solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (9)

1. A routing method for a web front end, comprising:
acquiring a new file at the front end of the web;
generating routing path information of each page based on the web front end new file;
generating a routing name corresponding to each page based on a preset rule;
and configuring a routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
2. The routing method for a web front end according to claim 1,
the step of obtaining the new file at the front end of the web comprises the following steps:
and acquiring the newly-built component file and the routing meta-information file.
3. The routing method for a web front end according to claim 2,
the generating of the routing path information of each page based on the new file at the front end of the web comprises the following steps:
taking a root component in the component file as a frame component of each page;
analyzing the page structure of each page in the routing meta-information file;
and generating routing path information corresponding to each page based on the frame component and the page structure.
4. The routing method for a web front end according to claim 2,
the generating of the route name corresponding to each page based on the preset rule includes:
acquiring routing path information corresponding to each page;
and adding preset identifiers among directory levels in the routing path information to generate routing names corresponding to the pages.
5. The routing method for the web front end according to any one of claims 1 to 4, further comprising, after configuring the routing configuration file corresponding to each page based on the routing path information and the corresponding routing name:
detecting whether the new file at the front end of the web changes in real time;
under the condition that the web front end new file changes, generating current routing path information of each page based on the current web front end new file;
the routing configuration file is updated based on the current routing path information.
6. The routing method for web front end according to claim 5, before the real-time detecting whether the new file of web front end is changed, further comprising:
receiving the conversion input of a user to the current working state;
under the condition that the current working state is the using state, stopping detecting whether the new file at the front end of the web changes in real time;
and under the condition that the current working state is a debugging state, detecting whether the new file at the front end of the web changes in real time.
7. A routing apparatus for a web front end, comprising:
the file acquisition module is used for acquiring a new file at the front end of the web;
the path generating module is used for generating routing path information of each page based on the web front end new file;
the name generation module is used for generating a routing name corresponding to each page based on a preset rule;
and the routing configuration module is used for configuring the routing configuration file corresponding to each page based on the routing path information and the corresponding routing name.
8. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the routing method for a web front end according to any of claims 1 to 6 are implemented by the processor when executing the program.
9. A non-transitory computer readable storage medium, having stored thereon a computer program, which, when being executed by a processor, carries out the steps of the routing method for a web front end according to any one of claims 1 to 6.
CN202110633220.8A 2021-06-07 2021-06-07 Routing method and device for web front end Pending CN113268260A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110633220.8A CN113268260A (en) 2021-06-07 2021-06-07 Routing method and device for web front end

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110633220.8A CN113268260A (en) 2021-06-07 2021-06-07 Routing method and device for web front end

Publications (1)

Publication Number Publication Date
CN113268260A true CN113268260A (en) 2021-08-17

Family

ID=77234474

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110633220.8A Pending CN113268260A (en) 2021-06-07 2021-06-07 Routing method and device for web front end

Country Status (1)

Country Link
CN (1) CN113268260A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835737A (en) * 2021-08-24 2021-12-24 交控科技股份有限公司 Method and system for adding authority to front-end project
CN114268538A (en) * 2021-12-08 2022-04-01 马上消费金融股份有限公司 Configuration method and device of front-end route
CN115268914A (en) * 2022-08-09 2022-11-01 华润数字科技有限公司 Micro front-end page generation method, device, equipment and medium based on modularization
CN116595285A (en) * 2023-07-19 2023-08-15 深圳复临科技有限公司 Route generation method, device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108390773A (en) * 2018-02-02 2018-08-10 上海汉得信息技术股份有限公司 A kind of method and apparatus of dynamic routing for scaffold
WO2018149395A1 (en) * 2017-02-16 2018-08-23 平安科技(深圳)有限公司 Routing configuration method for view file, and storage medium, terminal device and apparatus
CN109086114A (en) * 2018-07-26 2018-12-25 郑州云海信息技术有限公司 A kind of method, apparatus and terminal generating web front-end interactive interface

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018149395A1 (en) * 2017-02-16 2018-08-23 平安科技(深圳)有限公司 Routing configuration method for view file, and storage medium, terminal device and apparatus
CN108390773A (en) * 2018-02-02 2018-08-10 上海汉得信息技术股份有限公司 A kind of method and apparatus of dynamic routing for scaffold
CN109086114A (en) * 2018-07-26 2018-12-25 郑州云海信息技术有限公司 A kind of method, apparatus and terminal generating web front-end interactive interface

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
唐斌斌;叶奕;: "Vue.js在前端开发应用中的性能影响研究", 电子制作, no. 10, pages 49 - 50 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113835737A (en) * 2021-08-24 2021-12-24 交控科技股份有限公司 Method and system for adding authority to front-end project
CN114268538A (en) * 2021-12-08 2022-04-01 马上消费金融股份有限公司 Configuration method and device of front-end route
CN115268914A (en) * 2022-08-09 2022-11-01 华润数字科技有限公司 Micro front-end page generation method, device, equipment and medium based on modularization
CN116595285A (en) * 2023-07-19 2023-08-15 深圳复临科技有限公司 Route generation method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
CN113268260A (en) Routing method and device for web front end
CN108345543B (en) Data processing method, device, equipment and storage medium
US9372885B2 (en) System and methods thereof for dynamically updating the contents of a folder on a device
US9218324B2 (en) Method of encapsulating diverse user interface components while consistently enforcing external constraints
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
US10970052B2 (en) System and method for enhancing component based development models with auto-wiring
CN108108986B (en) Design method and device of customer relationship management system and electronic equipment
US11741002B2 (en) Test automation systems and methods using logical identifiers
CN111045653B (en) System generation method and device, computer readable medium and electronic equipment
EP4161015A1 (en) Network management system, method, and apparatus, and electronic device
CN112015468A (en) Interface document processing method and device, electronic equipment and storage medium
CN115599386A (en) Code generation method, device, equipment and storage medium
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
US10275525B2 (en) Method and system for mining trends around trending terms
CN111427577A (en) Code processing method and device and server
US11823701B2 (en) Network operation based on domain specific language
WO2022037627A1 (en) Integrated management method, apparatus and system for artificial intelligence applications
CN115033634A (en) Data acquisition method, data acquisition device, electronic equipment and medium
CN114610309A (en) Object configuration method, device, equipment and storage medium
CN112948264A (en) Test task execution method, device, system, storage medium and electronic device
CN116775030B (en) Method and device for creating security baseline
CN117008890B (en) Extended application development system and method
CN112306324B (en) Information processing method, apparatus, device and medium
US20230037019A1 (en) Techniques for distributed interface component generation
US20230010906A1 (en) System event analysis and data management

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