LoginSignup
1
1

More than 5 years have passed since last update.

nuxt.jsで複数ページの共通処理を書きたい時の選択肢

Last updated at Posted at 2018-10-31

nuxtServerInit

最初にだけ呼ばれる処理を書く時有効(ページ遷移ごとには読み込まれない?)

mixin

便利だが、asyncDataが使えないため、contextをもった処理はかけない
基本はメソッドなどの共通化に使うのが良い
参考 https://qiita.com/devneko/items/afe12b8acaf9648ccbb6

middleware

contextも持てるので便利。基本はこれを使うのが良さそう。

1
1
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
1