【问题标题】:Laravel Breeze Vue - Link and page not renderingLaravel Breeze Vue - 链接和页面未呈现
【发布时间】:2021-10-19 00:02:12
【问题描述】:

我正在开发一个应用程序并第一次使用 Laravel Breeze Vue。只是一些快速的背景知识,Laravel Breeze 提供了一些用于身份验证的快速脚手架。当用户登录时,他们会看到一个简单的仪表板页面。我已按如下所示添加了指向此页面的新链接。

app/resources/js/Layouts/Authenticated.vue

<!-- Navigation Links -->
<div class="hidden space-x-8 sm:-my-px sm:ml-10 sm:flex">
  <BreezeNavLink :href="route('dashboard')" :active="route().current('dashboard')">
    Dashboard
  </BreezeNavLink>
  <BreezeNavLink :href="route('client.index')" :active="route().current('client.index')">
    Clients
  </BreezeNavLink>
</div>

我还在文件路径 app/resources/js/Pages/Client/Index.vue 处创建了一个 Index.vue 文件。如下所示:

<template>
  <Head title="Clients" />

  <BreezeAuthenticatedLayout>
    <template #header>
      <h2 class="font-semibold text-xl text-gray-800 leading-tight">
        Clients
      </h2>
    </template>

    <div class="py-12">
      <div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
        <div class="bg-white overflow-hidden shadow-sm sm:rounded-lg">
          <div class="p-6 bg-white border-b border-gray-200">
            You're logged in!
          </div>
        </div>
      </div>
    </div>
  </BreezeAuthenticatedLayout>
</template>

<script>
import BreezeAuthenticatedLayout from '@/Layouts/Authenticated.vue'
import { Head } from '@inertiajs/inertia-vue3';

export default {
  components: {
    BreezeAuthenticatedLayout,
    Head,
  },
}
</script>

我在我的 web.php 文件中使用路由资源,如下所示。我已通过php artisan route:list 确认 client.index 是现有路由。

//client routing
Route::middleware(['auth', 'verified'])->group(function() {
  Route::resource('client', ClientController::class);
});

我面临两个问题。第一个问题是该链接不会在我的导航链接中呈现。第二个问题是 Index.vue 页面也不会呈现。我试过做npm run devnpm run watch 和清除缓存。这些都没有奏效。请向我提供一些有关如何解决这些问题的见解。

【问题讨论】:

    标签: laravel vue.js laravel-breeze


    【解决方案1】:

    这里已关闭。我正在使用旧硬件,并且需要时间来进行更改。 npm run dev 按预期执行。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-14
      • 1970-01-01
      • 2012-02-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-13
      相关资源
      最近更新 更多