如何在 Firestore 中的此类查询中进行分页?

问题描述

<script>
  $(function() {
    var filters = $('.advanced-filter'),el,elGroup,elHandle,activeTagInGroup;
    
    var acc = document.getElementsByClassName("accordion");
    var i;
    var panel;
    var firstPanel = acc[0].nextElementSibling;
        firstPanel.style.display = "block"; 
        acc[0].classList.toggle("active");

    for (i = 0; i < acc.length; i++) {
    acc[i].addEventListener("click",function() {
    
    this.classList.toggle("active");
    panel = this.nextElementSibling;
    if (panel.style.display === "block") {
      panel.style.display = "none";
    } else {
      panel.style.display = "block";
    }
  });
}

filters.on('click',function(e) {
      el = $(this);
      elGroup = el.data('group');
      elHandle = el.data('handle');
     activeTagInGroup = $('.active-filter[data-group="'+ elGroup +'"]');
      // If the tag clicked is not already active and its group contains an active tag,we will swap tag within the group.
      if ( !el.hasClass('active-filter')  && activeTagInGroup.size() ) {
        e.preventDefault();
        location.href = location.href
        // swap tag
        .replace(activeTagInGroup.data('handle'),elHandle)
        // go back to page 1
        .replace(/(&page=\d+)|(page=\d+&)|(\?page=\d+$)/,'');
        
      }
    }); 
  });
</script>

为此,我正在为我的应用创建类似 Instagram 的提要,我正在从我关注的用户那里获取帖子文档,但我想通过分页添加一些限制。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)