我正在尝试向 Laravel 8 Jetstream 添加一个新的 Livewire 组件,但看起来我做错了什么并收到以下错误。
错误:
Livewire\Exceptions\RootTagMissingFromViewException
Livewire encountered a missing root tag when trying to render a component. When rendering a Blade view, make sure it contains a root HTML tag
路线:
// web.php
Route::middleware('auth')->group(function() {
Route::get('/newEmployee', NewEmployee::class);
});
控制器:
// app/Http/Livewire/NewEmployee.php
namespace App\Http\Livewire;
use Livewire\Component;
class NewEmployee extends Component
{
public function render()
{
return view('livewire.new-employee')->layout('layouts.app')->name('NewEmployee');
}
}
看法:
<!-- resources/views/livewire/new-employee.blade.php -->
<div>
<div class="max-w-7xl mx-auto py-10 sm:px-6 lg:px-8">
<h1> New Wmployee </h1>
</div>
</div>