A single-page web front-end application routing implementation device and method
Through node hierarchical relationship analysis and enabling/disabling functional components, the problem of code complexity and browser dependency in the implementation of single-page web application routing is solved, and the operation of multiple discontinuous routes and the rendering of some DOM nodes are realized. Exclusion simplifies the implementation of routing functions.
Patent Information
- Application Number
- CN202211063068.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-31
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2042-08-31
AI Technical Summary
The existing single-page web application routing implementation method increases the code complexity and system burden, is highly dependent on the browser's implementation of the H5 standard, requires the configuration of complex routing tables, and cannot realize the simultaneous operation of multiple discontinuous routes and part of the DOM. Rendering exclusions for nodes.
Provides node hierarchical relationship analysis functional components, node enabling functional components and node disabling functional components. By analyzing DOM node hierarchical relationships and storing them as node trees, the display and hiding of specified DOM nodes can be realized, and the resident enabling state and routine are supported. This method reduces dependence on browser event monitoring and routing tables.
It reduces code complexity and system burden, avoids dependence on the browser H5 standard, supports the simultaneous operation of multiple discontinuous routes and the rendering exclusion of some DOM nodes, and simplifies the implementation of routing functions.
Smart Images

Figure CN116155806B
Abstract
Description
Technical Field
[0001] The present invention relates to a single-page web front-end application routing implementation device and method, belonging to the technical field of Internet. Background Art
[0002] Routing is an important technology in web applications. Traditional web applications use routes marked by URLs to locate specific pages that need to be rendered and displayed. The currently popular single-page web application (SPA) has only one HTML page but also uses a URL-like method to define the location of specific components that need to be rendered. This component positioning method is also called SPA routing.
[0003] The existing SPA routing implementation methods are related to the SPA's requirements for page rendering. The SPA web application page rendering requires that when switching routes, the HTML page data should not be reloaded from the server as much as possible, but only the component DOM nodes that need to be displayed should be rendered. To achieve this goal, the existing implementation schemes all use the browser hash routing mechanism and the HTML5 History routing mechanism.
[0004] More specifically, the hash routing mechanism is implemented by using the hash symbol # to represent a new route, because this symbol will not cause the browser URL to refresh, thus avoiding the triggering of reloading the HTML page data from the server. At the same time, the mechanism also listens to the onhashchange event to obtain changes in the hash value and locates the DOM for rendering according to the routing identifier (i.e., routing table) configured by the current SPA for the specific hash value; the HTML5 History routing mechanism is implemented by listening to the onpopstate event to obtain URL changes, and then using the history.pushState(state, title,url) and history. replaceState(state, title, url) system functions to modify the browser's URL record, thereby avoiding the triggering of reloading the HTML page data from the server. At the same time, the new URL value is compared with the routing identifier (i.e., routing table) configured by the current SPA web application for the specific URL routing value to locate the specific DOM for rendering.
[0005] To ensure the smooth operation of the above mechanism, the SPA web application also needs to configure a URL routing table to complete the mapping of hash values or URL values to specific component DOM.
[0006] In summary, existing implementation solutions all need to monitor and intercept browser system events, and use the characteristics or API of the browser URL refresh action to control the browser refresh behavior, while using the URL routing table to complete the operation.
[0007] The applicant has found that the prior art has at least the following technical problems:
[0008] 1. In the prior art, monitoring and intercepting browser events increases code complexity and system burden;
[0009] 2. In the existing technology, the HTML5 History routing mechanism is highly dependent on the browser's own implementation of the H5 standard;
[0010] 3. In the prior art, SPA web applications need to configure routing tables to assist in the implementation of routing functions. The routing tables of complex systems are very complex and prone to coding errors.
[0011] 4. In the prior art, when special user interactions require the simultaneous operation of several discontinuous routes, that is, the operation of several independent DOM nodes on an HTML page, the existing solution cannot be implemented;
[0012] 5. In the prior art, when a special user interaction needs to be switched to a route, the content within the scope of one or several child DOM nodes in the route is not rendered, that is, some child nodes of the DOM node corresponding to the route on the HTML page are excluded from this rendering, which cannot be achieved by the existing solution. Summary of the invention
[0013] The purpose of the present invention is to provide a single-page web front-end application routing implementation device and method to solve the problems in the prior art that monitoring and intercepting browser events increase code complexity and system burden; the HTML5 History routing mechanism is highly dependent on the browser's own implementation of the H5 standard; the SPA web application needs to configure a routing table to assist in the implementation of the routing function, and the routing table of a complex system will be very complex and prone to coding errors; when special user interactions require the simultaneous operation of several discontinuous routes, that is, the operation of several independent DOM nodes on an HTML page, the existing solution cannot be implemented; when special user interactions require switching to a route, the content within the scope of one or several child DOM nodes in the route is not rendered, that is, some child nodes of the DOM node corresponding to the route on the HTML page are excluded from this rendering, which are technical problems that the existing solution cannot achieve.
[0014] To achieve the above object, the present invention provides the following technical solutions:
[0015] The present invention provides a single-page web front-end application routing implementation device, including a node hierarchy relationship analysis function component, a node enabling function component, and a node disabling function component.
[0016] The operation of the node hierarchy analysis function component in the front-end application includes: analyzing the HTML page of the front-end application, analyzing the DOM node hierarchy of the HTML page of the front-end application, and storing the DOM node hierarchy of the HTML page of the front-end application analyzed by the node hierarchy analysis function component as a node tree reflecting the DOM node hierarchy;
[0017] The operations of the node enabling functional component in the front-end application include:
[0018] Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree;
[0019] Only display the specified DOM node and its child nodes;
[0020] The operation of the node disabling functional component in the front-end application includes:
[0021] Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree;
[0022] The specified DOM node and its child nodes are not displayed.
[0023] Furthermore, it also includes an object tree storage data structure, and the node hierarchy relationship analysis functional component stores the node tree in the object tree storage data structure.
[0024] Furthermore, the operation of the node hierarchical relationship analysis functional component in the front-end application also includes:
[0025] Providing a callback interface to the caller using the node hierarchy analysis function component, so that the caller can obtain the node tree stored in the object tree storage data structure;
[0026] Providing a calling interface to a caller using the node hierarchy analysis function component, the caller can obtain the subtrees of all child nodes of the DOM node stored in the node tree of the object tree storage data structure through the DOM node ID;
[0027] A calling interface is provided to the caller who uses the node hierarchy relationship analysis function component, and the caller can re-analyze the HTML page and refresh the content in the node tree.
[0028] Furthermore, the operation of the node enabling functional component in the front-end application also includes:
[0029] Providing a calling interface to a caller using the node enabling functional component, the caller can display the contents of several DOM nodes and their child nodes at the same time;
[0030] A calling interface is provided to the caller using the node enabling function component, and the caller can set a DOM node to be in a resident enabling state. The DOM node in the resident enabling state is in a display state and cannot be set to a disabled state in a conventional manner by the node disabling function component.
[0031] Furthermore, the operation of the node disabling functional component in the front-end application also includes:
[0032] Providing a calling interface to a caller who uses the node disabling function component, the caller can set the contents of several DOM nodes and their child nodes to a disabling state in a conventional manner, and hide the contents of the several DOM nodes and their child nodes;
[0033] Providing a calling interface to a caller who uses the node disabling function component, the caller can forcibly disable the DOM node set to the resident enabling state, and hide the content of the DOM node set to the resident enabling state;
[0034] A calling interface is provided to the caller of the node disabling functional component, and the caller can set all DOM nodes and their child nodes other than the DOM node set to the resident enabled state to be disabled in a conventional manner, and hide the contents of all DOM nodes and their child nodes other than the DOM node set to the resident enabled state.
[0035] Furthermore, the implementation method of the node enabling function component displaying only the specified DOM node and the child nodes of the specified DOM node includes:
[0036] The CSS display attributes of other DOM nodes except the specified DOM node and the child nodes of the specified DOM node are set to hidden attributes.
[0037] Furthermore, the implementation method of the node disabling function component not displaying the specified DOM node and the child nodes of the specified DOM node includes:
[0038] The CSS display attributes of the specified DOM node and the child nodes of the specified DOM node are set to hidden attributes.
[0039] Furthermore, the node hierarchy analysis functional component, the node enabling functional component, the node disabling functional component, and the object tree storage data structure are provided to the front-end application in the form of a Javascript library or an independent function.
[0040] The present invention also provides a single-page web front-end application routing implementation method, which is implemented based on the above-mentioned single-page web front-end application routing implementation device, and the steps of the method include:
[0041] S1, obtain a node tree reflecting the hierarchical relationship of DOM nodes;
[0042] S2, set the resident enable window;
[0043] S3, switch routing;
[0044] S4, exclude routing.
[0045] Furthermore, the sub-steps of step S1 include:
[0046] S11, after the front-end application loads the HTML page data, it calls the node hierarchy relationship analysis function component;
[0047] S12, analyzing the DOM node hierarchy of the HTML page of the front-end application through the node hierarchy analysis function component;
[0048] S13, storing the DOM node hierarchy of the HTML page of the front-end application analyzed by the node hierarchy analysis function component as a node tree reflecting the DOM node hierarchy, and the node tree is stored in the object tree storage data structure.
[0049] Furthermore, in step S2, the main frame DOM node of the front-end application is set as a resident enable window, and the main frame DOM node set as the resident enable window has the resident enable state.
[0050] Furthermore, in step S3, the node enabling function component is called to switch the routing operation, and the way of switching the routing includes:
[0051] Use the URL routing format as a parameter to display only the specified DOM node;
[0052] Use DOM ID as parameter to display only the specified DOM node.
[0053] Furthermore, in step S4, the node disabling function component is called to perform a route exclusion operation, and the route exclusion method includes:
[0054] Use the URL routing format as a parameter and do not display the specified DOM node;
[0055] Use DOM ID as parameter to hide the specified DOM node.
[0056] Based on the above technical solution, the embodiments of the present invention can at least produce the following technical effects:
[0057] (1) The present invention provides a single-page web front-end application routing implementation device and method, which does not monitor or intercept browser events, thereby reducing code complexity and system burden.
[0058] (2) The present invention provides a single-page web front-end application routing implementation device and method, which does not rely on the browser's own implementation of H5 routing related standards;
[0059] (3) The present invention provides a single-page web front-end application routing implementation device and method, which does not require the configuration of a routing table to assist in the implementation of the routing function;
[0060] (4) A single-page web front-end application routing implementation device and method provided by the present invention supports the simultaneous switching of several discontinuous routes, that is, several independent and discontinuous DOM nodes displayed on an HTML page at the same time;
[0061] (5) The present invention provides a single-page web front-end application routing implementation device and method, which supports switching to a route while not rendering the content within the scope of one or several child DOM nodes in the route, that is, excluding some child nodes in the DOM node corresponding to the route on the HTML page from this rendering. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] Figure 1 is a schematic structural diagram of an embodiment of the present invention;
[0063] Figure 2 It is a method flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0064] To further illustrate the purpose, technical solution features and advantages of the present invention, the preferred embodiments of the present invention will now be described clearly and completely in conjunction with the accompanying drawings. Obviously, the embodiments described in this section are only part of the embodiments of the present invention, not all of them.
[0065] The present invention provides a single-page web front-end application routing implementation device, comprising a node hierarchy relationship analysis function component, a node enabling function component, a node disabling function component, and an object tree storage data structure.
[0066] In a preferred embodiment of the present invention, the operation of the node hierarchical relationship analysis function component in the front-end application includes:
[0067] Analyze the HTML page of the front-end application, analyze the DOM node hierarchy of the HTML page of the front-end application, and store the DOM node hierarchy of the HTML page of the front-end application analyzed by the node hierarchy analysis function component as a node tree reflecting the DOM node hierarchy, and store the node tree in an object tree storage data structure;
[0068] Providing a callback interface to the caller using the node hierarchy analysis function component, so that the caller can obtain the node tree stored in the object tree storage data structure;
[0069] Providing a calling interface to a caller using the node hierarchy analysis function component, the caller can obtain the subtrees of all child nodes of the DOM node stored in the node tree of the object tree storage data structure through the DOM node ID;
[0070] A calling interface is provided to the caller who uses the node hierarchy relationship analysis function component, and the caller can re-analyze the HTML page and refresh the content in the node tree.
[0071] In a preferred embodiment of the present invention, the operation of the node enabling functional component in the front-end application includes:
[0072] Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree;
[0073] Only display the specified DOM node and its child nodes;
[0074] Providing a calling interface to a caller using the node enabling functional component, the caller can display the contents of several DOM nodes and their child nodes at the same time;
[0075] A calling interface is provided to the caller using the node enabling function component, and the caller can set a DOM node to be in a resident enabling state. The DOM node in the resident enabling state is in a display state and cannot be set to a disabled state in a conventional manner by the node disabling function component.
[0076] In a preferred embodiment of the present invention, the operation of the node disabling function component in the front-end application includes:
[0077] Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree;
[0078] Do not display the specified DOM node and the child nodes of the specified DOM node;
[0079] Providing a calling interface to a caller who uses the node disabling function component, the caller can set the contents of several DOM nodes and their child nodes to a disabling state in a conventional manner, and hide the contents of the several DOM nodes and their child nodes;
[0080] Providing a calling interface to a caller who uses the node disabling function component, the caller can forcibly disable the DOM node set to the resident enabling state, and hide the content of the DOM node set to the resident enabling state;
[0081] A calling interface is provided to the caller of the node disabling functional component, and the caller can set all DOM nodes and their child nodes other than the DOM node set to the resident enabled state to be disabled in a conventional manner, and hide the contents of all DOM nodes and their child nodes other than the DOM node set to the resident enabled state.
[0082] In a preferred embodiment of the present invention, by setting the CSS display attributes of other DOM nodes except the specified DOM node and its child nodes as hidden attributes, the purpose of displaying only the specified DOM node is achieved; by setting the CSS display attributes of the specified DOM node and its child nodes as hidden attributes, the purpose of not displaying the specified DOM node is achieved.
[0083] Preferably, the node hierarchy analysis functional component, the node enabling functional component, the node disabling functional component, and the object tree storage data structure are provided to the front-end application in the form of a Javascript library or an independent function.
[0084] The relationship between the node hierarchy analysis function component, the node enabling function component, the node disabling function component, and the object tree storage data structure is shown in the attached figure. Figure 1 As shown:
[0085] The collaborative working principle of the node hierarchy analysis function component, the node enabling function component, and the node disabling function component is: the routing function of the SPA web application actually lets the front-end application know which DOM node or nodes should be displayed at present through a form similar to a URL identifier, while other DOM nodes are hidden.
[0086] The effective mechanism of the preferred embodiment of the present invention is to obtain the node tree reflecting the DOM node hierarchy of the entire HTML loaded by calling the node hierarchy analysis function component at an appropriate time point in the life cycle of the SPA web application, generally when the application is initialized and HTML is loaded.
[0087] The node enabling function component and the node disabling function component receive the URL information input and analyze and determine which DOM node or nodes to be operated, and then the node enabling function component and the node disabling function component display or hide the DOM node or nodes. If a special node is set to a permanent enabled state, then the node will be displayed all the time without being affected by the normal disabling operation of the node disabling function module.
[0088] At the same time, SPA web applications can also use nodes to enable functional modules to actively hide the specified DOM to meet the needs of various business interactions.
[0089] Because the above operation only changes the css display properties of the DOM and its child nodes, this operation will not trigger changes in the browser's routing records, nor will it cause the browser to refresh data. Therefore, while achieving the SPA web application routing function, it does not invade or affect the browser's routing records, achieving the sandbox operation effect of the browser routing mechanism.
[0090] Moreover, the information of the URL or DOM node is directly input into the node-enabling functional component and the node-disabling functional component, so this mechanism does not require the configuration of a complex routing table, which simplifies the code complexity.
[0091] As attached Figure 2 The present invention also provides a single-page web front-end application routing implementation method, which is implemented based on the above-mentioned single-page web front-end application routing implementation device.
[0092] In a preferred embodiment of the present invention, a JS class is used to implement the node hierarchy analysis function component, the node enabling function component, the node disabling function component and the object tree storage data structure for use by the caller.
[0093] Node hierarchical relationship analysis function component: getNodeObjByViewID(viewNodeId, cbFunc);
[0094] Node enabling function component: activeView(viewNodeIds);
[0095] Node deactivation function component: deactiveView(viewNodeIds);
[0096] The sample code is as follows:
[0097] class CRouter{
[0098] constructor(){
[0099] this.nodesTree = {};
[0100] }
[0101] getNodeObjByChildViewID(viewNodeId, cbFunc);
[0102] activeView(viewNodeIds);
[0103] deactiveView(viewNodeIds);
[0104] }
[0105] In a preferred embodiment of the present invention, the steps to implement the function are as follows:
[0106] S1, obtain the node tree reflecting the hierarchical relationship of DOM nodes:
[0107] After the front-end application loads the HTML page data, it calls the node hierarchy relationship analysis function component (equivalent to S11), for example, using <script>标签加载CRouter.getNodeObjByViewID(viewNodeId, cbFunc),其中输入参数viewNodeId设置为空null,当该参数为null时该组件将分析本HTML页面中的所有DOM节点关系(相当于S12通过所述节点层次关系分析功能组件分析出所述前端应用的HTML页面的DOM节点层次关系),最后将分析的结构保存在CRouter.nodesTree(对象树存储数据结构)中(相当于S13,将所述节点层次关系分析功能组件分析出的前端应用的HTML页面的DOM节点层次关系存储为反映DOM节点层次关系的节点树,所述节点树存储于所述对象树存储数据结构)。
[0108] S2:设置常驻使能窗口:
[0109] 在整个SPA页面开始渲染前,调用节点使能功能组件将本SPA需要一直显示的主框架DOM节点设置为常驻使能窗口,调用时有两种参数形式,第一种传入传统的URL路由格式作为参数CRouter.activeView(' / mainFrm'); 第二种直接传入该主窗体对应的DOM ID作为参数CRouter.activeView(mainFrm);
[0110] 是否设置常驻窗口依据SPA具体的业务需求而定,对常见应用来说需要这样的一个常驻主窗口,但也不排除有特殊人机交互要求的SPA不需要这样一个常驻主窗体。
[0111] S3:切换路由:
[0112] 对需要进行路由切换的操作,直接调用节点使能功能组件进行路由切换。例如需要切换到ID为subView的DOM所在的节点路由,同样地在调用节点使能功能组件时有两种参数形式,第一种传入传统的URL路由格式作为参数CRouter.activeView(' / subView'); 第二种直接传入该主窗体对应的DOM ID作为参数CRouter.activeView(subView);
[0113] 在特殊的用户交互需求下,例如需要同时切换到ID为subView1、subView2的DOM所在的节点路由,实际上传统现有方式无法实现这一需求。可调用节点使能功能组件实现,而且也支持两种路由格式参数输入,第一种传入传统的URL路由格式作为参数CRouter.activeView(' / subView1', ' / subView2'); 第二种直接传入该主窗体对应的DOMID作为参数CRouter.activeView(subView1, subView2);
[0114] 在需要做路由切换的地方可以反复重复S3的操作完成所需的路由切换。
[0115] 如果SPA的业务要求在当前路由中排除一些DOM节点,则可按S4的操作进行。
[0116] S4:排除路由:
[0117] 在当前路由中排除一个或者一些DOM节点,直接调用节点去使能功能组件进行路由排除。例如想将当前路由中ID为subView1、subView2的DOM所在的节点排除,即隐藏这两个节点,可调用节点去使能功能组件实现,而且也支持两种路由格式参数输入,第一种传入传统的URL路由格式作为参数CRouter.deactiveView (' / subView1', ' / subView2'); 第二种直接传入该主窗体对应的DOM ID作为参数CRouter.deactiveView (subView1,subView2);
[0118] 通过S1、S2、S3、S4步骤即可完成一轮完整的SPA路由操作。
[0119] 可以理解,本发明是通过本优选实施例进行描述的,本领域技术人员知悉的,在不脱离本发明的精神和范围的情况下,可以对这些特征和本实施例进行各种改变或等效替换。另外,在本发明的教导下,可以对这些特征和本实施例进行修改以适应具体的情况而不会脱离本发明的精神和范围。因此,本发明不受此处所公开的具体实施例的限制,所有落入本申请的权利要求范围内的实施例都属于本发明所保护的范围内。< / script>
Claims
1. A single-page web front-end application routing implementation device, characterized in that: It includes node hierarchical relationship analysis functional component, node enabling functional component, and node disabling functional component. The operation of the node hierarchy analysis function component in the front-end application includes: analyzing the HTML page of the front-end application, analyzing the DOM node hierarchy of the HTML page of the front-end application, and storing the DOM node hierarchy of the HTML page of the front-end application analyzed by the node hierarchy analysis function component as a node tree reflecting the DOM node hierarchy; The operations of the node enabling functional component in the front-end application include: Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree; Only display the specified DOM node and its child nodes; The operation of the node disabling functional component in the front-end application includes: Obtain a node tree stored in the node hierarchy analysis function component, and obtain a hierarchical nesting relationship between a parent node and a child node of a specified DOM node according to the node tree; Do not display the specified DOM node and the child nodes of the specified DOM node; The operation of the node disabling functional component in the front-end application also includes: Providing a calling interface to a caller who uses the node disabling function component, the caller can set the contents of several DOM nodes and their child nodes to a disabling state in a conventional manner, and hide the contents of the several DOM nodes and their child nodes; Providing a calling interface to a caller who uses the node disabling function component, the caller can forcibly disable the DOM node set to the resident enabling state, and hide the content of the DOM node set to the resident enabling state; A calling interface is provided to the caller of the node disabling functional component, and the caller can set all DOM nodes and their child nodes other than the DOM node set to the resident enabled state to be disabled in a conventional manner, and hide the contents of all DOM nodes and their child nodes other than the DOM node set to the resident enabled state.
2. A single-page web front-end application routing implementation device according to claim 1, characterized in that: It also includes an object tree storage data structure, and the node hierarchy relationship analysis function component stores the node tree in the object tree storage data structure.
3. A single-page web front-end application routing implementation device according to claim 2, characterized in that: The operation of the node hierarchical relationship analysis functional component in the front-end application also includes: Providing a callback interface to the caller using the node hierarchy analysis function component, so that the caller can obtain the node tree stored in the object tree storage data structure; Providing a calling interface to a caller using the node hierarchy analysis function component, the caller can obtain the subtrees of all child nodes of the DOM node stored in the node tree of the object tree storage data structure through the DOM node ID; A calling interface is provided to the caller who uses the node hierarchy relationship analysis function component, and the caller can re-analyze the HTML page and refresh the content in the node tree.
4. A single-page web front-end application routing implementation device according to claim 1, characterized in that: The operation of the node enabling functional component in the front-end application also includes: Providing a calling interface to a caller using the node enabling functional component, the caller can display the contents of several DOM nodes and their child nodes at the same time; A calling interface is provided to the caller using the node enabling function component, and the caller can set a DOM node to be in a resident enabling state. The DOM node in the resident enabling state is in a display state and cannot be set to a disabled state in a conventional manner by the node disabling function component.
5. A single-page web front-end application routing implementation device according to claim 1, characterized in that: The implementation method of the node enabling function component only displaying the specified DOM node and the child nodes of the specified DOM node includes: The CSS display attributes of other DOM nodes except the specified DOM node and the child nodes of the specified DOM node are set to hidden attributes.
6. A single-page web front-end application routing implementation device according to claim 1, characterized in that: The implementation method of the node disabling function component not displaying the specified DOM node and the child nodes of the specified DOM node includes: The CSS display attributes of the specified DOM node and the child nodes of the specified DOM node are set to hidden attributes.
7. A method for implementing routing of a single-page web front-end application, implemented based on a device for implementing routing of a single-page web front-end application according to any one of claims 1 to 6, characterized in that: The steps of the method include: S1, obtain a node tree reflecting the hierarchical relationship of DOM nodes; S2, set the resident enable window; S3, switch routing; S4, exclude routing.
8. A method for implementing single-page web front-end application routing according to claim 7, characterized in that: The sub-steps of step S1 include: S11, after the front-end application loads the HTML page data, it calls the node hierarchy relationship analysis function component; S12, analyzing the DOM node hierarchy of the HTML page of the front-end application through the node hierarchy analysis function component; S13, storing the DOM node hierarchy of the HTML page of the front-end application analyzed by the node hierarchy analysis function component as a node tree reflecting the DOM node hierarchy, and the node tree is stored in an object tree storage data structure.
9. A method for implementing single-page web front-end application routing according to claim 7, characterized in that: In step S2, the main frame DOM node of the front-end application is set as a resident enable window, and the main frame DOM node set as the resident enable window has the resident enable state.
10. A method for implementing single-page web front-end application routing according to claim 7, characterized in that: In step S3, the node enabling function component is called to switch the routing operation, and the method of switching the routing includes: Use the URL routing format as a parameter to display only the specified DOM node; Use DOM ID as parameter to display only the specified DOM node.
11. A method for implementing single-page web front-end application routing according to claim 7, characterized in that: In step S4, the node disabling function component is called to perform a route exclusion operation, and the route exclusion method includes: Use the URL routing format as a parameter and do not display the specified DOM node; Use DOM ID as parameter to hide the specified DOM node.
