tv2regionerne/statamic-endless 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tv2regionerne/statamic-endless

最新稳定版本:v1.4.0

Composer 安装命令:

composer require tv2regionerne/statamic-endless

包简介

README 文档

README

Statamic Endless allows you to create infinite scroll lists that automatically or manually load new entries when you get to the end.

How to Install

You can search for this addon in the Tools > Addons section of the Statamic control panel and click install, or run the following command from your project root:

composer require tv2regionerne/statamic-endless

How to Use

Make sure Livewire v3 is installed, then use the collection:endless tag:

{{ collection:endless as="posts" from="blog" paginate="5" }}
    <div x-ref="append">
        {{ posts }}
            {{ partial:blog/post }}
        {{ /posts }}
    </div>
    <button x-on:click="trigger" x-show="paginate.has_more_pages">Load More</button>
{{ /collection:endless }}

Example with intersectors:

{{ collection:endless as="posts" from="blog" paginate="5" }}
    <div x-ref="append">
        {{ posts }}
            {{ partial:blog/post }}
        {{ /posts }}
    </div>
    <div
    x-data="{
        intersecting: false,
        init() {
            $watch('intersecting', () => this.check());
        },
        check() {
            if (this.intersecting && paginate.has_more_pages) {
                trigger().then(() => this.check());
            }
        },
    }"
    x-show="!loading && paginate.has_more_pages"
    x-intersect:enter="intersecting = true"
    x-intersect:leave="intersecting = false">
</div>
{{ /collection:endless }}

You must enable pagination.

The content will be wrapped in a Livewire/Alpine component:

  • You should add an x-ref of either append or prepend to the element that contains your list.
  • You can call trigger to load more entries using x-intersect or x-on.
  • You can check the loading state with loading.

On secondary loads variables from outside tag scope will only be avaliable if you list them in the context parameter (pipe delimited). These variables must be serializable.

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2024-04-25