johncarter / statamic-livewire-forms
此包的最新版本(v1.0.2)没有可用的许可证信息。
使用Laravel Livewire提交在Statamic CMS中创建的表单。
v1.0.2
2023-09-20 08:12 UTC
Requires
- jonassiewertsen/statamic-livewire: ^2.4
- statamic/cms: 3.* || 4.*
README
此插件允许您使用Laravel Livewire在Statamic CMS中提交表单。
安装
通过composer安装此包
composer require johncarter/statamic-livewire-forms
使用
包含Livewire样式和脚本
<html> <head> <!-- /... --> {{ livewire:styles }} </head> <body> <!-- /... --> {{ livewire:scripts }} </body> </html>
运行命令生成视图
php artisan statamic-livewire-forms:make:view
或者,您可以在/resources/views/livewire/form-view.blade.php
中手动创建视图。
在视图中绑定属性,如下所示
<input autocomplete="name" type="text" wire:model.lazy="data.name" /> @error('data.name')<div>{{ $message }}</div>@enderror
在模板中嵌入livewire组件
{{ livewire:statamic-form handle="contact_form" }}
如果没有设置view
参数,组件将默认为表单处理程序的短横线命名法,例如/resources/views/livewire/contact-form.blade.php
注意 & 限制
- 仅测试了文本和文本区域表单字段类型。
- 未在多站上测试
- 未使用任何静态缓存策略测试。
更新日志
请参阅更新日志获取最近更改的更多信息。
许可证
MIT许可证(MIT)。请参阅许可证文件获取更多信息。