Skip to content

组件概述

Lartrix 提供 120+ 个组件,覆盖后台开发的各种场景。

组件分类

分类说明数量
NaiveUI基础 UI 组件100+
Business业务组件10+
Common通用组件10+
Custom自定义组件10+
JsonJSON 组件2

命名约定

NaiveUI 组件

PHP 类名无 N 前缀,输出保留 N 前缀:

PHP 类输出组件
Button::make()NButton
Input::make()NInput
SwitchC::make()NSwitch
EmptyState::make()NEmpty

SwitchC 说明

Switch 是 PHP 保留字,所以使用 SwitchC

基础用法

php
use Lartrix\Schema\Components\NaiveUI\Button;

$button = Button::make('点击我')
    ->type('primary')
    ->props(['size' => 'large'])
    ->on('click', SetAction::make('visible', true));

链式调用

所有组件都支持链式调用:

php
Card::make()
    ->title('卡片标题')
    ->children([
        Input::make()
            ->props(['placeholder' => '请输入'])
            ->model('form.name'),
        Space::make()
            ->children([
                Button::make('取消'),
                Button::make('保存')->type('primary'),
            ]),
    ]);

查看详细文档

基于 MIT 许可发布