我有一个名为 dashboard.blade.php
的 Blade,它是这样的:
@extends( 'frontend.dashboard_main' )
@section('title') Profile @endsection
@section('style')
SOME CUSTOM STYLES
@endsection
dashboard.blade.php
是这样的:
@include( 'frontend.header' )
...
在 header.blade.php
,我添加了以下内容:
<head>
<title>@yield('title')</title>
@yield('style')
...
但现在的问题是,SOME CUSTOM STYLES 似乎不起作用,@yield('style')
无法加载 css 样式。
所以如果你知道这里出了什么问题,请告诉我......
答案 0 :(得分:1)
用于在扩展视图中包含 css
和 js
文件。最好使用堆栈而不是产量
内部frontend/dashboard_main
<header>
other css files and meta
@stack('styles')
</header>
并在扩展视图中
@push('styles')
<style>
</style>
@endpush