SuperAPI AI 工具集

livewire-index-component

编程与开发

查看项目

更新于 10-16 06:50

技能介绍

用途:创建资源的列表/索引页,作为浏览记录的主入口;当用户需要可搜索、可排序或可分页的列表时使用。相关技能包括 livewire-resource-config 与 livewire-form-component。

基础结构:组件继承 Naykel\Gotime\Livewire\BaseIndex,设置 $modelClass,并通过 configKey() 返回配置键,query() 方法可自定义查询。

搜索:若配置包含 searchableFields,引入 Searchable trait,并在 query 中调用 $this->applySearch($query)。

排序:若配置包含 sortColumn,引入 Sortable trait,并在 query 中调用 $this->applySorting($query);sortDirection 由 trait 自动应用。

组合功能:可同时 use Searchable, Sortable,在 query 中先应用排序再搜索。

分页与筛选、操作等能力在资料中未提供具体实现细节。