とんたんの技術メモ

注)ただのメモです。

nuxtjs SSRでライフサイクルが実行される場所

サーバーサイド

  • nuxtServerInit
  • plugin
  • middreware(画面遷移でも実行)
  • validate
  • asyncData
  • fetch
  • beforeCreate
  • computed
  • created

クライアントサイド

  • plugin
  • beforeCreate
  • computed
  • created
  • beforeMount
  • mounted
  • destroyed

plugin, beforeCreate, computed, createdはサーバー、クライアントで2回呼び出される(画面遷移時は実行されない) nuxtServerInitは、初期データとか設定したい場合これ使うといいかも。(SPAでは使えない)