【发布时间】:2022-09-22 20:52:01
【问题描述】:
我想为访客和应用程序页面使用内联 livewire 组件。默认情况下,我知道 livewire 会恢复为 layout.app,而且我知道您可以更新所有整页渲染的默认布局。
我正在阅读此文档https://laravel-livewire.com/docs/2.x/rendering-components,并且能够使用仅拥有blade 和.PHP 文件的常规方法使其工作。
public function render()
{
return <<<\'HTML\'
<div>
example page view
</div>
HTML;
}
是否可以从我们直接返回 HTML 的内联组件中的文档中执行此操作?
public function render()
{
return view(\'livewire.show-posts\')
->layout(\'layouts.guest\');
}
public function render()
{
return <<<\'HTML\'
<div>
example page view
</div>
HTML; ->layout(\'layouts.guest\'); // something along the lines of this
}