konradkalemba/blade-components-scoped-slots
最新稳定版本:0.1.2
Composer 安装命令:
composer require konradkalemba/blade-components-scoped-slots
包简介
Scoped slots feature addition to Laravel's Blade templating engine
README 文档
README
Scoped slots feature addition to Laravel's Blade templating engine. The package adds two new Blade directives: @scopedslot and @endscopedslot. Inspired by Vue's scoped slots feature.
Installation
composer require konradkalemba/blade-components-scoped-slots
Usage example
index.blade.php
@component('components.list', ['objects' => $objects]) @scopedslot('item', ($object)) // It is also possible to pass outside variable to the scoped slot // by using the third parameter: @scopedslot('item', ($object), ($variable)) <li> {{ $object->name }} @if($object->isEditable) <a href="{{ route('objects.edit', $object->id) }}">{{ __('Edit') }}</a> @endif </li> @endscopedslot @endcomponent
components/list.blade.php
<ul>
@foreach($objects as $object)
{{ $item($object) }}
@endforeach
</ul>
License
统计信息
- 总下载量: 13.75k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 29
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-10