2016-08-09 3 views
1

저는 spring-boot로 폴리머 webApp에서 작업하고 있습니다. 지금까지 탭에서 탭으로 이동하는 방법을 알 수 없기 때문에 두 가지 별도의 앱을 사용했습니다. 두 가지를 병합하고 싶습니다. 버튼을 눌러도 괜찮습니다.동적 페이지를 통한 탐색 폴리머

첫 번째 그림에서 볼 수있는 것처럼 탭을 통해 응용 프로그램 탭을 탐색하면 다른 그림의 응용 프로그램으로 이동합니다. 웹을 통해 많은 검색을하지만 정적 콘텐츠를 탐색하는 방법 만 찾을 수 있습니다.

이 첫 번째 응용 프로그램에게 있습니다 enter image description here

와 SRC

enter image description here

이 다른 응용 프로그램

enter image description here

와 SRC

enter image description here

답변

3

app-route 구성 요소를 사용할 수 있습니다. https://elements.polymer-project.org/elements/app-route

다음은 app-route에 대한 polycast입니다. https://www.youtube.com/watch?v=iAgSvlYavX0&list=PLOU2XLYxmsII5c3Mgw6fNYCzaWrsM3sMN&index=2

기본적으로 route 및 page 속성을 사용하여 활성 경로를 설정합니다. 어떤 코드가 활성화되어 있는지의 전환은 iron-selector 구성 요소를 사용하여 수행됩니다. 이 같은

뭔가 :

<app-location route="{{ route }}"></app-location> 
<app-route route="{{ route }}" 
      pattern="/:page" 
      data="{{ routeData }}" 
      tail="{{ subroute }}"></app-route> 

<iron-selector attr-for-selected="route" 
       selected="[[ page ]]" 
       role="navigation"> 
    <a route="editor" href="/editor">Editor</a> 
    <a route="analyze" href="/analyze">Analyze</a> 
    <a route="community" href="/community">Community</a> 
</iron-selector> 

<iron-pages role="main" 
      attr-for-selected="route" 
      selected="[[ page ]]"> 
    <my-editor route="editor"></my-editor> 
    <my-analyze route="analyze"></my-analyze> 
    <my-community route="community"></my-community> 
</iron-pages> 

<script> 
    Polymer({ 
     is:'my-element', 
     properties: { 
      page: { 
       type: String, 
       notify: true, 
       reflectToAttribute: true, 
       observer: "_pageChanged" 
      } 
     }, 

     observers: [ 
      "_routePageChanged(routeData.page)" 
     ], 

     attached: function(e) { 
      // Lazyload the views as soon as the AppShell has been Painted 
      this.importHref(
       this.resolveUrl("my-editor.html"), null, null, true); 
      this.importHref(
       this.resolveUrl("my-analyze"), null, null, true); 
      this.importHref(
       this.resolveUrl("my-community"), null, null, true); 

      // If the application is reloaded, redirect to /analyze 
      if(this.page != "analyze"){ 
       this.set("route.path", "/analyze"); 
      } 
     }, 

     _changeRoute: function(e) { 
      this.set("route.path", e.detail.requestRoute); 
     }, 

     _routePageChanged: function(page) { 
      this.page = page || "analyze"; 
     }, 
    }) 
</script> 
+0

그래 난이 비디오를 보았다하지만 난 철 - 선택과 철 - 페이지 구성 요소가 내 샘플에서 탭 요소 – mahaSaez

+0

에 연결하는 방법을 모른다 철분 선택기는 내비게이션 막대 옵션이고 철분 페이지는 페이지 전환 관리자이고 페이지는 경로 속성 값입니다. 아이언 - 선택기 옵션을 클릭하면 href "go/editor"로 URL에 알리고, 변수 페이지를 의 route 값으로 업데이트합니다. page는 사용 된 변수입니다 아이언 페이지에서 어떤 코드가 활성화되어야 하는지를 알기 때문에 attibute 페이지와 같은 이름을 가진 속성 라우트를보고 해당 코드를 활성화합니다. – MarioAleo

관련 문제