angular.js - 单页面,angular2 路由的懒加载 能实现页面共存吗
phpcn_u1582
phpcn_u1582 2017-05-15 17:08:03
0
3
820
  1. 想实现的效果: 点击连接,新建一个多标签页面,在这个多标签页面里面展示路由对应的页面(类似easyui的多标签)

  2. 问题: 我看网上的教程都是, 点击一个链接,会覆盖上一个链接的页面。我的内容区域 永远只有一个页面,是不是单页面应用无法实现我想要的效果

phpcn_u1582
phpcn_u1582

reply all(3)
左手右手慢动作

I have read the question 3 times over and over again. I don’t know if what the questioner wants to express is the effect achieved by the taregt attribute of the a tag. . .

https://developer.mozilla.org...

target
This attribute specifies where to display the linked resource. In HTML4, this is the name, or for a keyword, of a box. In HTML5, it is a name or keyword for a browsing context (for example, tab, window, or iframe). The following keywords have special meaning:
_self: The current page is loaded, that is, the current response to the same HTML 4 frame (or HTML5 browsing context). This value is the default if no attribute is specified.
_blank: A new window opens, i.e. to a new unnamed HTML4 window or HTML5 browser context
_parent: Loads the response into the current frame's HTML4 parent frame or the current HTML5 browsing context's parent browsing context. If there is no parent frame or browsing context, this option behaves the same as _self.
_top: In IHTML4: Load the response into the complete, original window, canceling all other frames. In HTML5: Load the response into the top-level browsing context (i.e., the browsing context that is an ancestor of the current one and has no parent). If there is no parent frame or browsing context, this option behaves the same as _self.
This attribute can only be used if the href attribute exists.

左手右手慢动作

This kind of single page is easy to implement:

If yesAngular2:

Write oneService用来存储Tab(如果刷新后Tab还有的话,最好用localStorage).

In the original IFrame position, place the route IFrame位置,放置路由<outlet></outlet>Angular2,

is used to replace the route output.

<outlet></outlet>The above Tab is a simple array, corresponding to the Tab title and route. After clicking, jump to the specified route, and the content of

will be automatically replaced according to the route configuration.

But there is a problem. Because it is a direct replacement, it is best to save the page status, otherwise it will switch back to the initialized interface.

This is just a simple solution, it would be better to separate each Tab separately. 🎜
小葫芦

Sir, I also encountered this problem. Could you please solve it

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template