2015-04-02 30 views
3

我試圖使用流星離子庫(https://github.com/meteoric/meteor-ionic)爲我的應用程序。我想出瞭如何添加左側菜單。但是,每當我導航到另一個頁面時,左上角的導航按鈕和中心標題消失。這些按鈕僅出現在索引頁的新載入中。如果從瀏覽器的邊緣拖動,我可以將菜單拉出。一個流星離子:Sidemenu按鈕消失點擊

下面是HTML:

<template name="layout"> 
    {{#ionBody}} 
    {{#ionSideMenuContainer}} 
     {{#ionSideMenus}} 
     {{#ionSideMenu}} 
      <div class="bar bar-header bar-dark"> 
      <h1 class="title">Menu</h1> 
      </div> 
      <div class="content has-header"> 
      <div class="list"> 
       {{> sideNavItems}} 
       <div class="item item-icon-right" data-ion-menu-close> 
       Close Me {{> ionIcon icon="ios-arrow-right"}} 
       </div> 
      </div> 
      </div> 
     {{/ionSideMenu}} 
     {{/ionSideMenus}} 

     {{#ionSideMenuContent}} 
     {{#contentFor "headerButtonLeft"}} 
      <button class="button button-clear pull-left" data-ion-menu-toggle="left"> 
      {{> ionIcon icon='navicon'}} 
      </button> 
     {{/contentFor}} 
     {{#contentFor "headerTitle"}} 
      <h1 class="title">MyApp</h1> 
     {{/contentFor}} 
     {{> ionNavBar class="bar-positive"}} 
     {{#ionNavView}} 
      {{> yield}} 
     {{/ionNavView}} 
     {{/ionSideMenuContent}} 
    {{/ionSideMenuContainer}} 
    {{/ionBody}} 
</template> 

<template name="sideNavItems"> 
    <div class="item item-icon-right" data-ion-menu-close> 
    <a href="{{ pathFor 'page1'}}">Page1</a> 
    </div> 
    <div class="item item-icon-right" data-ion-menu-close> 
    <a href="{{ pathFor 'page2'}}">Page2</a> 
    </div> 
</template> 

<template name="page1"> 
    {{#ionContent}} 
    <p>Page1</p> 
    {{/ionContent}} 
</template> 

回答

0

Meteoric ionNavBar了 「headerButtonLeft」, 「headerTitle」 和 「headerButtonRight」 是ionNavBar的組成部分。

我建議你設置這些由每個模板設置這些組件創建的ionNavBar後:

<template name="page1"> 
    {{#contentFor "headerButtonLeft"}} 
    <button class="button button-clear pull-left" data-ion-menu-toggle="left"> 
     {{> ionIcon icon='navicon'}} 
    </button> 
    {{/contentFor}} 
    {{#contentFor "headerTitle"}} 
    <h1 class="title">MyApp</h1> 
    {{/contentFor}} 

    {{#ionView}} 
    <p>Page1</p> 
    {{/ionView}} 
</template>