superlatif/nova-tag-input

Laravel Nova 的标签输入字段。

4.0.1 2022-10-11 10:01 UTC

This package is auto-updated.

Last update: 2024-09-11 14:33:16 UTC


README

此插件通过创建一个新的字段类型,将 Johannes Munari 的 Vue Tags Input 插件集成到 Laravel Nova 中。

Nova Tag Input

Nova 4

此版本必须与 Nova 版本 4 及以上一起使用。感谢 @dmason30 的 Pull Request。要安装与 Nova 3 兼容的版本,请参阅以下内容。

安装

使用 Composer

composer require superlatif/nova-tag-input

示例

基本

Tags::make(__("Tags"), 'tags')
    ->help("Press ENTER to add tag")
    ->placeholder("Add a new tag")
    ->allowEditTags(true)
    ->addOnKeys([13, ':', ';', ',']) // 13 = Enter key
    ->autocompleteItems([
        'Arizona',
        'California',
        'Colorado',
        'Michigan',
        'New York',
        'Texas',
    ]),

从 Eloquent 自动完成项目

$tags = Tag::pluck('title')->get();
Tags::make(__("Tags"), 'tags')
    // ...
    ->autocompleteItems($tags)
    // ...

参数

安装

要使用与 Nova 3 兼容的版本,请使用以下命令

composer require superlatif/nova-tag-input:3.0

支持我们!

如果您认为我们在开发过程中为您节省了一些时间,请考虑表示您的感激之情 😁

Buy Me A Coffee