[英]Uncaught Error: [vue-router] "path" is required in a route configuration
[英]Using an absolute path in a vue-router route
在我的 Vue 應用程序中,我有以下路線(以及其他路線)
{
path: '/event/:eventId?',
name: 'event',
component: EventTask
},
{
path: '/terms-and-conditions',
name: 'terms-and-conditions',
component: TermsAndConditions
}
條款和條件的鏈接顯示在頁腳中,因此可以從任何頁面訪問。 如果我在活動路線上,我點擊了條款和條件的鏈接
<router-link to="terms-and-conditions">
<v-btn text>Terms of Use</v-btn>
</router-link>
瀏覽器導航到路徑/event/terms-and-conditions
而不是/terms-and-conditions
。 我怎樣才能使它成為一個絕對的路線,所以它總是導航到/terms-and-conditions
?
您可以指定路線的名稱
<router-link :to="{ name: 'terms-and-condition' }">
<v-btn text>Terms of Use</v-btn>
<router-link>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.