私のプロジェクトでvue-routerを使用しています。ページ再ロード時にparamsが動作しないvue-routerルート
私の名前付きルートに完全に細かくナビゲートすることができます。私の唯一の問題は、パラメータを期待する名前付きルートを使用するときです。ページを更新するとロードされません。私が使用していますか
'/example/:username': {
name: 'example-profile',
title: 'Example Profile',
component: ExampleComponent
}
これはvue-router
route
:
は、ここに私のルートである
<a v-link="{ name: 'example-profile', params: { username: raaaaf } }">
Example Link
</a>
私はmydomain.com/example/raaaaf
を得るExample Link
を選択
最初の読み込み時に正しいテンプレートがレンダリングされますが、アドレスバーにリンクを更新または手動で入力すると、Page Not Found
ページにリダイレクトされ、ページの作成時に呼び出されるメソッドはトリガーされません。
これは私が私のに持っているものです。
<template>
<div class="small-12 left">
<side-bar></side-bar>
<div class="store-right">
<store-details></store-details>
<store-menu></store-menu>
<store-listings></store-listings>
</div>
</div>
</template>
<script>
export default {
data() {
return {
username: null,
user: null,
}
},
created() {
this.getUser()
},
methods: {
getUser() {
console.log(this.$route.params);
}
}
}
</script>