阅读(3760) (4)

Laravel 8 显示组件

2021-06-28 16:48:16 更新

要显示一个组件,您可以在 Blade 模板中使用 Blade 组件标签。 Blade 组件以 x- 字符串开始,其后紧接组件类 kebab case 形式的名称(即单词与单词之间使用短横线 - 进行连接):

<x-alert/>

<x-user-profile/>

如果组件位于 AppViewComponents 目录的子目录中,您可以使用 . 字符来指定目录层级。例如,假设我们有一个组件位于 AppViewComponentsInputsButton.php,那么我们可以像这样渲染它:

<x-inputs.button/>