【发布时间】:2022-11-12 11:51:33
【问题描述】:
我目前在路由中遇到问题。这是场景:
当没有 id 查询时,惯性工作正常。
但是在导航到编辑并且我想单击任何导航链接(例如单击仪表板链接)后,它会抛出一个 404 代码,说明该页面不存在。仅仅是因为它没有删除 /category/{id},而是在末尾添加仪表板而不是删除查询。
有没有办法通过不违反惯性路由来解决这个问题?
这是代码:
认证布局
const navigation = [
{ name: 'Dashboard', href: 'dashboard', current: false },
{ name: 'Category', href: 'category', current: false },
]
<nav class="hidden lg:flex lg:space-x-8 lg:py-2" aria-label="Global">
<Link v-for="item in navigation" :key="item.name"
:href="item.href" :class="[item.current ? 'bg-gray-100
text-gray-900' : 'text-gray-900 hover:bg-gray-50
hover:text-gray-900', 'rounded-md py-2 px-3 inline-flex
items-center text-sm font-medium']" :aria-
current="item.current ? 'page' : undefined">{{ item.name
}}</Link>
</nav>
【问题讨论】:
-
尝试 href="route('dashboard')" - 但我认为它不起作用。
标签: vue.js laravel-9 inertiajs inertial-navigation ziggy