Inertia <Head> 组件在标题中添加了“- Laravel”后缀

问题描述 投票:0回答:1

我使用 Laravel Inertia 和 React 作为我的应用程序的前端。当我使用 Inertia 的 组件在 React 组件中设置标题时,它会自动将“-Laravel”附加到标题末尾。

<Head>
    <title>This is the title</title>
    <meta name="description" content="A detailed description of My Page." />
</Head>

问题:

尽管使用 Inertia 的 组件将标题设置为“This is the title”,但页面标题显示为“This is the title - Laravel”。

附加信息:

  • 我在前端使用 Laravel Inertia 和 React。
  • 有没有办法防止在 Inertia 中使用 组件时,标题中添加“-Laravel”后缀?
reactjs laravel inertiajs
1个回答
0
投票

您应该检查“/resources/js/app.jsx”文件。

最初的配置是:

const appName = import.meta.env.VITE_APP_NAME || 'Laravel';
VITE_APP_NAME
文件中获取
.env
值。

在您的情况下,可能在

.env
文件中找不到它,默认情况下是“Laravel”

© www.soinside.com 2019 - 2024. All rights reserved.