LoginSignup
1
0

More than 3 years have passed since last update.

Nuxt での"NavigationDuplicated" エラー

Posted at

NavigationDuplicated の発生条件と回避方法

環境

nuxt: 2.0.0

確認できた発生条件

他にもあるかもしれないが、リダイレクトを行ったとき、リダイレクト先のパスとリクエストされたページのパスが同じ時に発生した。

回避方法

単純にリクエストと同じパスにリダイレクトしない。筆者の場合はmiddlewareにstoreのデータ次第でどのページがリクエストされても、ある特定のページにリダイレクトする、という処理を入れた際に発生したので、以下のような処理を入れて回避した。

middleware/sample.js
if (route.path !== '/target') redirect('/target')

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0