[英]Laravel @section Does not seem to be working
我有一個名為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')
...
但現在的問題是,一些自定義樣式似乎不起作用, @yield('style')
不加載 css 樣式。
所以如果你知道這里出了什么問題,請告訴我......
用於在擴展視圖中包含css
和js
文件。最好使用堆棧而不是產量
內部frontend/dashboard_main
<header>
other css files and meta
@stack('styles')
</header>
並在擴展視圖中
@push('styles')
<style>
</style>
@endpush
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.