Laravel Blade 组件和插槽:插槽内容不会彼此并排显示

Laravel Blade components and slots: slot content not displayed beside each other

我正在使用 blade 个组件,并且我有一个带有两个插槽的组件。我想将图像传递给第一个插槽,将文本传递给第二个插槽。它们应该并排显示,但它们是分开显示的。

插槽代码片段:

<h1>
    {{ $icon }} {{ $title }}
</h1>

填充插槽的代码片段:

@component('components.pageheader')
       @slot('icon')
            <img src="{{ asset('img/an_image.png') }}" width="28px" height="28px">
       @endslot
       @slot('title')
            myTitle
       @endslot
@endcomponent

我错过了什么?

尝试在包装 div 上为 img 设置 display:inline-block,如下所示

@component('components.pageheader')
       @slot('icon')
            <div style="display:inline-block; margin-right:10px">
                <img src="{{ asset('img/an_image.png') }}" width="28px" height="28px">
            </div>
       @endslot
       @slot('title')
            myTitle
       @endslot
@endcomponent