Laravel - 刀片附加部分

时间:2016-06-29 21:02:47

标签: javascript laravel-5 blade

我需要在子视图中运行一个js脚本,所以我有一个包含所有脚本的部分,在子视图中我尝试将我的脚本附加到现有脚本。

HTML PAGE:

<html><head></head><body></body>@yield('scripts')</html>

部分:

@section('scripts') <!-- my standard scripts --> @stop

子视图:

@section('scripts') <!-- my new script --> @append

我已经在子视图@section(&#39;脚本&#39;)中尝试了@parent但是没有用。

感谢&#39; S

1 个答案:

答案 0 :(得分:0)

你的主视图必须有这样的脚本

@Test

然后,您可以使用@section('scripts') // your scripts here @show 标记从子模板<{1}}添加脚本

@parent