私の子供ルートのbeforeEnterガードを定義しようとしていますが、成功しません。ここに私のルートの設定です:私はページを更新したり(例:BASE_PATH /パス2)をブラウザにURLを直接挿入するとVue-router:beforeEnterガードが子パスに対して正しく動作しない
...
{
path: '/',
component: App
beforeEnter: (to, from, next) ->
# This block is only reached when I refresh the page
children: [
{
name: 'component1',
path: '/component1',
components: component1
},
{
name: 'path2',
path: '/path2',
components: component2
},
...
]
}
...
すべてが正常に動作します。しかし、path1またはpath2にリダイレクトするルータリンクをクリックすると、beforeEnterガードは実行されません。
私は間違ったことを理解しましたか?各子供にbeforeEnterガードを設定する必要がありますか?