php Laravel 5.4组件和插槽

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Laravel 5.4组件和插槽相关的知识,希望对你有一定的参考价值。

<div class="alert alert-{{$type or 'success'}}" role="alert">
  @if (isset($title))
    <h2>{{$title}}</h2>
  @endif
  {{$slot}}
</div>
<div class="jumbotron">
  <h1>{{$title}}</h1>
  <p>{{$slot}}</p>
  <p><a class="btn btn-primary btn-lg" href="#" role="button">{{$button or "Learn More"}}</a></p>
</div>
<!-- This is the main Blade file that you want your components to show up in -->

<!DOCTYPE html>
<html lang="{{ config('app.locale') }}">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <!-- Fonts -->
        <link href="{{mix('css/app.css')}}" rel="stylesheet" type="text/css">

        <!-- Styles -->

    </head>
    <body>
        <div class="container">
            @component('components.jumbotron')
              @slot('title')
                Welcome DevMarketers!
              @endslot

              This is an awesome tutorial about all the new features that have arrived in Laravel 5.4. I recommend leaving a like if you enjoyed this video and a comment about what you want to learn next! Thanks so much for your support. Go DevMarketers!

              @slot('button')
                Click Like!
              @endslot
            @endcomponent

            @component('components.alert')
              @slot('type')
                danger
              @endslot --}}

              @slot('title')
                Error!
              @endslot

              We could not process your request...
            @endcomponent
        </div>
    </body>
</html>

以上是关于php Laravel 5.4组件和插槽的主要内容,如果未能解决你的问题,请参考以下文章

Vue js 无法在 Laravel 5.4 中渲染组件

LARAVEL 5.4:ValidatePostSize.php 中的 PostTooLargeException(第 24 行)

Vue 组件未显示 - Passport 实现 Laravel 5.4

laravel 5.4 php artisan serve 无效请求(意外的 EOF)

php [Laravel - 自定义错误消息] Laravel 5.4其他登录条件 - 添加自定义错误消息。 #All #Script #Laravel #Php

我无法在 Laravel 5.4 上测试简单的 vue 示例组件