【发布时间】:2015-12-03 18:36:02
【问题描述】:
我正在使用 Laravel 5 。 我正在尝试使用以下方法在页面中包含不同的内容:
@include('example_page_content_one')
@include('example_page_content_two')
我包含的每个页面都有自己的脚本。
@section('script')
<script>
</script>
@endsection
在浏览包含所有内容页面的 父 页面时,只有 example_page_content_two 页面中的脚本有效,其他脚本 都在 >parent 和 example_page_content_one 不起作用。
我在 parent 页面中扩展 master.blade.php。
在我使用的母版页中
@yield('script')
有什么方法可以在不使用不同的 section 名称的情况下解决这个问题。 即
在 example_page_content_one
@section('scriptExampleOne')@endsection
在 example_page_content_two
@section('scriptExampleTwo')@endsection
在主刀片中
@yield('scriptExampleOne')
@yield('scriptExampleTwo')
【问题讨论】:
标签: javascript laravel include