2
我有一個視圖parent.view
,其中包括另一個視圖child.view
。 parent.view
延伸parent.layout
和child.view
延伸child.layout
。他們都有一個部分content
。當包括子視圖時,parent.view
的content
被child.view
的content
覆蓋。這似乎不是正確的行爲。有沒有辦法解決?包含的視圖覆蓋父視圖的部分
父視圖:
@extends('parent.layout')
@section('content')
<h1>Foo</h1>
@include('child.view')
@show
子視圖:
@extends('child.layout')
@section('content')
<h1>Bar</h1>
@stop
預期結果:
<h1>Foo</h1>
<h1>Bar</h1>
實際結果:
<h1>Bar</h1>
你嘗試在你的'兒童View'使用'@ parent'? –
@TimLewis不幸的是,include被嵌套在父級的標記中,所以調用'@ parent'只是將它放在頁面的開頭或結尾。 – Shane