首页 > 解决方案 > Laravel - 公司徽标显示在子菜单中失真

问题描述

在我的 Laravel-5.8 应用程序中,我尝试将公司徽标从文件夹加载到页面标题中:

<a href="{{ route('home') }}" class="brand-link logo-switch navbar-dark bg-gray-light">
  <img src="public/storage/myLogo.png" alt="MyApp" class="brand-image-xl logo-xs">
  <img src="public/storage/myLogo.png" alt="MyApp" class="brand-image-xs logo-xl" style="left: 12px">
</a>

我这样称呼它:

@include('layouts.partials.brand-logo')

我观察到在主菜单上,图像看起来不错,但在太阳菜单上显示“MyApp”。也就是说,alt

我该如何解决这个问题?

谢谢

标签: htmllaravel

解决方案


像这样更改您的路径以访问公用文件夹中的文件

<a href="{{ route('home') }}" class="brand-link logo-switch navbar-dark bg-gray-light">
  <img src="{{asset('storage/myLogo.png')}}" alt="MyApp" class="brand-image-xl logo-xs">
  <img src="{{asset('storage/myLogo.png')}}" alt="MyApp" class="brand-image-xs logo-xl" style="left: 12px">
</a>

推荐阅读