删除 Blade 组件 类 以使其匿名时出错

Error when I delete Blade components classes to make them anonymous

我从创建普通组件开始我的项目,现在我想将一些组件转换为匿名组件。

我知道匿名组件 匿名 是缺少 class.

样本

我有这个 Blade 代码:

<x-app-layout>
    <x-slot:header>
        Some heading
        <a href="" title="" class="inline-block bg-blue-400 hover:bg-blue-500 text-white mx-1 p-2 rounded-full">

            <x-icons.plus />

        </a>
    </x-slot:header>
...
</x-app-layout>

当我删除 app\View\Components\Icons\Plus.php 并重新访问该页面时,出现以下错误:

ErrorException
include(\path\vendor\composer/../../app/View/Components/Icons/Plus.php): Failed to open stream: No such file or directory

我遵循了 Laracasts 的回答并清除了缓存:

❯ php artisan view:clear
Compiled views cleared!

但同样的错误仍然存​​在。

非常令人困惑的是,当我创建一个新组件 php .\artisan make:component bruh.plus --view 并在相同的 Blade 代码中使用它 (<x-bruh.plus/>) 时一切正常。

我不得不放弃作曲家的自动加载器。

从现在开始,我假设将普通 Blade 组件转换为匿名组件的正确方法是 运行:

php artisan view:clear

composer dump-autoload