awkwardideas / parrot
将请求的变量重复返回,作为 Laravel 中 JavaScript 模板的占位符
dev-master
2017-03-17 22:39 UTC
Requires
- php: >=5.6.4
This package is auto-updated.
Last update: 2024-08-29 04:25:33 UTC
README
通过 Composer 安装
$ composer require awkwardideas/parrot
添加到 config/app.php
在包服务提供程序下添加
AwkwardIdeas\Parrot\ParrotServiceProvider::class,
在 Facades/类别名下添加
'Parrot' => AwkwardIdeas\Parrot\Facades\Parrot::class,
可用指令
@parrot('view.name', ['some' => "", 'data'=>"", 'parrotClass'=>"CustomClass", 'parrotID'=>"templateID"])
- 类似于 @include blade 指令。提供自己的数据以在模板中使用,您只需定义高级变量,实际值不是必需的。Parrot 将模拟这些变量的值。
- 可以提供 parrotClass 键以通过 @parrotClass 输出。这将仅回显类,因此需要位于 class="" 属性内。
- 可以提供 parrotID 键以通过 @parrotID 输出。这将回显 id='parrotIDValue',因此您的标记中的 ID 可以是可选的。
@parrotif('view.name', ['some' => ""])
类似于 @includeif blade 指令
@parrotClass
如果模板使用 parrot 调用,它将显示 $parrotClass 变量。如果未提供自定义类,则输出默认类 parrotTemplate。
@parrotID
如果模板使用 parrot 调用,它将显示 $parrotID 变量。
@onParrot
开始用于 parrot 使用的 if 情况。如果没有被 parrot,模板将不会渲染包含的内容。可以使用 @else
与 @onParrot
一起使用。
@endOnParrot
结束 @onParrot
的 if 情况
@noParrot
开始用于模板在没有 parrot 的情况下渲染的 if 情况。如果被 parrot,模板将不会渲染包含的内容。可以使用 @else
与 @noParrot
一起使用。
@endNoParrot
结束 @endNoParrot
的 if 情况