laravel8 jetstream 脚手架中 调用components x-jet 的使用原理

最近重新学习laravel8 jetstream 脚手架,遇到了一个很诡异的问题, component组件调用的时候全部写的是<x-jet-名称></x-jet-名称> 类似的, 不知道在哪儿设置这个x-jet,怎么能自己的项目中一样的处理方式修改新增的components, 比如 x-home 或者 x-dev 等重写使用,有人能解释一下吗?

《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
最佳答案

App\Providers\JetstreamServiceProvider的 register 中加入:

    public function register()
    {
        \Illuminate\Support\Facades\Blade::component('jetstream::components.liamhao', 'jet-liamhao');
    }

然后你就能用<jet-liamhao> </jet-liamhao>

来源于 Stack Overflow

3年前 评论
讨论数量: 4

App\Providers\JetstreamServiceProvider的 register 中加入:

    public function register()
    {
        \Illuminate\Support\Facades\Blade::component('jetstream::components.liamhao', 'jet-liamhao');
    }

然后你就能用<jet-liamhao> </jet-liamhao>

来源于 Stack Overflow

3年前 评论

components 的路径在 admin/components 的话 jetstream::component 怎么找到此路径,有没有相关设置》

3年前 评论

解决了
在 App\Providers\JetstreamServiceProvider 的 register 中加入:

  public function register()
    {
        \Illuminate\Support\Facades\Blade::component(Home::class, 'home-welcome');
        \Illuminate\Support\Facades\Blade::component(Admin::class, 'Admin-welcome');
    }

使用的方式<x-home-welcome /><x-admin-welcome/>

3年前 评论
mengdodo
$ php artisan make:component MyComponent

创建两个文件 /resources/views/components/my-component.blade.php 和 /app/View/Components/MyComponent.php.

只需要编辑my-component.blade.php文件内容,然后在你需要植入的视图地方使用 x-tag ,例如:

<x-my-component></x-my-component>
2年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!