gilbertchiao / nova-custom-text-card
一个用于自定义卡片标题和内容的 Laravel Nova 卡片。
v1.0.0
2021-07-11 07:46 UTC
Requires
- php: >=7.1.0
This package is auto-updated.
Last update: 2024-09-11 15:24:06 UTC
README
一个用于自定义卡片标题和内容的 Laravel Nova 卡片。
安装
您可以通过 composer 在使用 Nova 的 Laravel 应用中安装此包
composer require gilbertchiao/nova-custom-text-card
然后,在 NovaServiceProvider 的 cards 方法或您的 Resource 类中注册您的卡片。
public function cards() { return [ (new CustomTextCard()) ->heading('Card #1') ->content('default'), (new CustomTextCard()) ->width('2/3') ->heading('Card #2') ->content('contentClass()') ->contentClass('text-5xl justify-center'), (new CustomTextCard()) ->width('full') ->heading('Card #3') ->headingAlign('right') ->contentHtml('<p class="text-center text-5xl" style="color:lightblue;">headingAlign() & contentHtml()</p>') ]; }
选项
width(string $width)
卡片宽度。
content(string $content)
卡片内容。
contentClass(string $class)
内容的自定义类。
内容块默认类为 "flex text-90 font-light items-center",自定义类将附加到它。如果您想替换类,只需在 $class 前面加上一个 "!" 字符,然后自定义类将替换它。
示例
->contentClass("justify-center") // "flex text-90 font-light items-center justify-center"->contentClass("!flex font-bold items-center justify-end") // "flex font-bold items-center justify-end"
注意:这不会适用于 HTML 格式的内容。
contentHtml(string $html)
卡片 HTML 格式的内容。如果设置了 content() 和 contentHtml(),则只 contentHtml() 会生效。
forceFullWidth()
强制卡片为全宽度。 nova 卡片顺序的修复。
heading(string $heading)
卡片的标题。
headingAlign(string $alignment)
标题的对齐方式(左、中或右)。
注意:这不会适用于 HTML 格式的标题。
headingHtml(string $html)
卡片的 HTML 格式标题。
background(string $backgroundStyle)
卡片的 CSS 背景属性。
border(string $borderStyle)
卡片的 CSS 边框属性。
color(string $colorStyle)
卡片的 CSS 颜色属性。
height(string $height)
卡片的 CSS 高度属性(默认、auto 或 NNNpx)。
源代码
本包受到 Krato/NovaTextCard 的启发。
许可协议
MIT 许可协议(MIT)。请参阅 许可文件 获取更多信息。
