evo-mark/evo-laravel-sortable-treeview
Composer 安装命令:
composer require evo-mark/evo-laravel-sortable-treeview
包简介
Sortable Treeview Laravel/Inertia websites
README 文档
README
Requirements (v2)
- Vue 3.5+
- Vuetify 4.0+
- Inertia 3.0+
Installation
Add the following repository to your composer.json file:
"repositories": [ { "type": "vcs", "url": "https://github.com/evo-mark/evo-laravel-sortable-treeview" } ],
and then this to your require section:
"require": { "evo-mark/evo-laravel-sortable-treeview": "^2.0.0" }
then run composer update.
JavaScript
Once you've installed the composer package, you can install the PNPM package symlink:
pnpm add vendor/evo-mark/evo-laravel-sortable-treeview
Usage
Configuration
To publish your config file for SortableTreeview, run:
php artisan v:p --provider="EvoMark\EvoLaravelSortableTreeview\SortableTreeviewProvider"
Model
To setup a model as sortable, add the following to the model:
use EvoMark\EvoLaravelSortableTreeview\Traits\SortableTreeModel; class Model { use SortableTreeModel; }
Controller
Pass the treeview items to the frontend like so:
return Inertia::render('setup/tyre-group/index', [ 'tyreGroups' => fn() => SortableTreeview::for(TyreGroup::class)->setConfig([]) ->setHeaders([ [ 'value' => 'actions', 'title' => 'Actions' ] ])->get() ]);
You can call setConfig with the following options:
| Prop | Type | Default | Description |
|---|---|---|---|
| lazy | bool | false | Enables lazy loading of child items instead of loading the full tree upfront. |
| maxDepth | int | null | null | Maximum depth of the tree. null means no limit. |
| itemChildren | string | "children" | Key used to access child items in each node. |
| itemChildrenCount | string | "children_count" | Key used to access the number of children for a node. |
| itemTitle | string | "title" | Key used for the display label/title of each item. |
| itemValue | string | "id" | Key used as the unique identifier for each item. |
| loadChildrenRoute | string | "{$routePrefix}lazy" | Route used to fetch children dynamically when lazy loading is enabled. |
| loadChildrenMethod | string | "get" | HTTP method used for loading children. |
| updateSortOrderRoute | string | "{$routePrefix}sort" | Route used to persist updated sort order. |
| updateSortOrderMethod | string | "put" | HTTP method used for updating sort order. |
| updateItemRoute | string | "" | Route used to update an individual item. |
| updateItemMethod | string | "PATCH" | HTTP method used to update an individual item. |
Frontend
Finally, your frontend should look like this:
<template> <EvoSortableTreeview model="tyreGroups"> <template #item.title="{ item }"> {{ item.name }} </template> <template #item.columns="{ item }"> <VBtnGroup> <VBtn color="error" :icon="mdiDelete" variant="text"></VBtn> </VBtnGroup> </template> </EvoSortableTreeview> </template> <script setup> import { EvoSortableTreeview } from 'evo-laravel-sortable-treeview'; </script>
Slots
The following slots are available inside the SortableTreeview component:
| Slot Name | Props | Description |
|---|---|---|
| item.prepend-title | { item } |
Rendered before the main item title. Useful for icons, badges, or prefixes. |
| item.title | { item, title } |
Main title content for the item. Defaults to displaying item[itemTitle]. |
| item.append-title | { item } |
Rendered after the main item title. Useful for actions, tags, or metadata. |
| item.columns | { item } |
Renders additional column content aligned to the right of the item. |
evo-mark/evo-laravel-sortable-treeview 适用场景与选型建议
evo-mark/evo-laravel-sortable-treeview 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 224 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 04 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 evo-mark/evo-laravel-sortable-treeview 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 evo-mark/evo-laravel-sortable-treeview 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 224
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 24
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BUSL-1.1
- 更新时间: 2025-04-16