定制 tv2regionerne/statamic-endless 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tv2regionerne/statamic-endless

最新稳定版本:v2.0.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.

统计信息

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

GitHub 信息

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

其他信息

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