2016-05-25 49 views
1

在我index.html我有一個paper-scroll-header-panelpaper-toolbar和作爲頁面內容的自定義元素:鐵滾動閾值

<body unresolved> 
    <template is="dom-bind" id="app"> 
     <paper-scroll-header-panel> 
      <paper-toolbar class="medium-tall"> 
       ... 
      </paper-toolbar> 

      <!-- Main Content --> 
      <div class="content"> 
       <x-content></x-content> 
      </div> 
     </paper-scroll-header-panel> 
    </template> 
</body> 

x-content,我有一個firebase-collection對此我遍歷顯示數據:

<dom-module id="x-content"> 
    <template> 
     <firebase-collection 
      limit-to-first="30" 
      location="myFirebaseURL" 
      data="{{items}}"></firebase-collection> 

     <template is="dom-repeat" items="{{items}}"> 
      <x-item item="{{item}}"></x-item> 
     </template> 
    </template> 
    <script> 
     Polymer({ 
      is: "x-content", 
      _loadMoreData: function (e) { 
       // load more 
      } 
     }); 
    </script> 
</dom-module> 

我希望能夠在用戶滾動時加載更多數據。我試圖執行iron-scroll-threshold,但它不起作用。我希望我需要使用scrollTarget屬性將它鏈接到將觸發滾動事件的元素,但我不確定我應該使用哪個元素。

我試圖將其設置爲bodydocumentpaper-scroll-header-panel但是當我滾動都未工作 - 有的甚至射擊頁面加載時,沒有滾動發生!

有沒有人試過嗎?

+0

本嗨, 你一找到解決這個問題?我們正面臨同樣的問題。這可能與以某種方式聲明範圍有關嗎? 謝謝 – Cygorger

+0

還沒有。我會再試一次,看看我能不能分類。 –

回答

1

你可以嘗試鏈接到paperScrollHeaderPanel.scroller 並確保在加載數據的功能來清除觸發器:

scrollThreshold.clearTriggers(); 

see this

+0

謝謝你。令人煩惱的是,我可能不能在firebase中使用它,因爲這個想法是改變'firebase-collection'的'limitToFirst'屬性。直到我意識到它初始化一個新的查詢,而不是更多地進行到底。 –

+0

我已經有了閾值工作,但是我在2個獨立的鐵頁上有2個列表,它們都是在headerPanel上定位的,但是一個閾值觸發了這兩個列表。我怎樣才能防止這一點? – Daantje

+0

Daantje,你可以使用這個[app-scrollpos-control](https://elements.polymer-project.org/elements/app-layout?active=app-scrollpos-control) – framled