Laravel刀片组件和插槽:插槽内容不显示在彼此旁边
我正在使用刀片组件,我有一个带有两个插槽的组件。我想将图像传递到第一个插槽,将文本传递到第二个插槽。它们应该并排显示,但它们以单独的行显示 插槽的代码段:Laravel刀片组件和插槽:插槽内容不显示在彼此旁边,laravel,laravel-blade,Laravel,Laravel Blade,我正在使用刀片组件,我有一个带有两个插槽的组件。我想将图像传递到第一个插槽,将文本传递到第二个插槽。它们应该并排显示,但它们以单独的行显示 插槽的代码段: <h1> {{ $icon }} {{ $title }} </h1> {{$icon}{{$title} 填充插槽的代码片段: @component('components.pageheader') @slot('icon') <img src="{
<h1>
{{ $icon }} {{ $title }}
</h1>
{{$icon}{{$title}
填充插槽的代码片段:
@component('components.pageheader')
@slot('icon')
<img src="{{ asset('img/an_image.png') }}" width="28px" height="28px">
@endslot
@slot('title')
myTitle
@endslot
@endcomponent
@component('components.pageheader'))
@插槽('图标')
@端槽
@插槽(“标题”)
我的头衔
@端槽
@端部元件
我遗漏了什么?尝试设置img的包装器div上的display:inline块,如下所示
@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
@component('components.pageheader'))
@插槽('图标')
@端槽
@插槽(“标题”)
我的头衔
@端槽
@端部元件
尝试标签上的style=“display:inline block;margin right:10px;”“
谢谢!我把标签放在了一个帖子里,作为建议的答案,以方便后续的访问者