signifly/nova-progressbar-card

Laravel Nova 进度条卡片

v0.2.1 2019-09-30 08:57 UTC

This package is auto-updated.

Last update: 2024-08-29 05:08:30 UTC


README

Latest Version on Packagist Total Downloads License

此包允许您在 Nova 中添加进度条卡片到您的资源和仪表板。

Example

免责声明

此包仍在开发中。请随时帮助改进它。

需求

安装

只需运行

composer require signifly/nova-progressbar-card

之后,设置将完成,您可以使用此处列出的组件。

基本用法

// in App\Nova\Product
...
use Signifly\Nova\Cards\ProgressBar\ProgressBar;
...

/**
 * Get the cards available for the request.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return array
 */
public function cards(Request $request)
{
    return [
        (new ProgressBar)->options(['title' => 'Translations', 'percentage' => 0.5]);
    ];
}

高级选项

自定义颜色

public function cards(Request $request)
{
    return [
        (new ProgressBar)->options([
            'title' => 'Translations',
            'percentage' => 0.5,
            'color' => '#123456',
        ]);
    ];
}

动画进度条颜色 A -> B

public function cards(Request $request)
{
    return [
        (new ProgressBar)->options([
            'title' => 'Translations',
            'percentage' => 0.5,
            'colorFrom' => '#aaa',
            'colorTo' => '#bbb',
            'animateColor' => true,
        ]);
    ];
}

线条宽度

public function cards(Request $request)
{
    return [
        (new ProgressBar)->options([
            'title' => 'Translations',
            'percentage' => 0.5,
            'strokeWidth' => 8,
        ]);
    ];
}

半圆形类型进度条

public function cards(Request $request)
{
    return [
        (new ProgressBar)->options([
            'title' => 'Translations',
            'percentage' => 0.5,
            'type' => 'semi-circle',
        ]);
    ];
}

请随时提出改进建议。