Easy Loading Screens with Vue Suspense Components

子層

製作模擬延遲 3 秒的 async function

現在去父層

  1. 放入 async component
  2. 放入 async component 還沒跑完的預設 component
  3. 全部用 Suspense 包起來

如果子層元件 fetch data有 error 出現,使用 onErrorCaptured 抓取

印出 error message

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Jason

Jason

Nothing is true, everything is permitted.