dshgnt2008 2015-10-28 22:22
浏览 66
已采纳

Laravel Blade:与Jinja2块相似的东西

Is there an existing way in Blade to mimic Jinja2's block construct?

I understand it is possible to use @yield('content', '<h1>Default content</h1>'), but this is clunky and ugly if you want the default content to be much bigger than a small string.

  • 写回答

1条回答 默认 最新

  • dsdfd2322 2015-10-28 23:34
    关注

    Yes, you can use @section/@show instead of @yield:

    @section('content')
    default content
    @show
    

    and override as usual:

    @section('content')
    override
    @stop
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?