Skip to content

loading spinner ๊ตฌํ˜„

Jin Young Park edited this page Dec 20, 2020 · 1 revision

Component lifecycle๋กœ ๋ฌดํ•œ loading spinner ํ•ด๊ฒฐ

๊ธฐ์กด loading spinner ์‹œ์ 

  • ์‹œ์ž‘ : beforeRouteUpdate(๋ผ์šฐํ„ฐ ๋ณ€๊ฒฝ ๋•Œ๋งˆ๋‹ค)
  • ์ข…๋ฃŒ : mounted(์™„์ „ํžˆ ๋งˆ์šดํŠธ๋œ ์‹œ์ )

์ปดํฌ๋„ŒํŠธ๊ฐ€ ํ•œ๋ฒˆ ์ธ์Šคํ„ด์Šคํ™”๋˜์–ด ์ƒ์„ฑ๋˜๋ฉด created=>mounted๋ฅผ ๊ฑฐ์น˜๊ณ , ๋‹ค์‹œ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ์— ์ ‘๊ทผํ•˜๋ฉด key๊ฐ’์„ ์„ค์ •ํ•ด์ฃผ์ง€ ์•Š์€ ๊ฒฝ์šฐ lifecycle์„ ๋‹ค์‹œ ๊ฑฐ์น˜์ง€ ์•Š๊ณ  ํ•ด๋‹น ์ธ์Šคํ„ด์Šค๋ฅผ ์žฌํ™œ์šฉ(reuse)ํ•œ๋‹ค.

์ด๋กœ ์ธํ•ด ๋ผ์šฐํ„ฐ๋ฅผ ๋ณ€๊ฒฝํ•ด๋„ ํ•ด๋‹น ์ปดํฌ๋„ŒํŠธ๊ฐ€ ์ด๋ฏธ ๋ฐฉ๋ฌธํ•ด์„œ ์ธ์Šคํ„ด์Šค๋กœ ๋‚จ์•„์žˆ์œผ๋ฉด (visited) mounted๋ฅผ ๊ฑฐ์น˜์ง€ ์•Š๋Š”๋‹ค.

๋”ฐ๋ผ์„œ loading spinner๊ฐ€ ์‹œ์ž‘์€ ๋˜์ง€๋งŒ ์ข…๋ฃŒ๊ฐ€ ๋˜์ง€ ์•Š๋Š” ๊ฒƒ์ด๋‹ค.

๋ณ€๊ฒฝ๋œ loading spinner ์‹œ์ 

  • ์‹œ์ž‘ : created(์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ ์‹œ์ . )
  • ์ข…๋ฃŒ : mounted๋กœ ๋™์ผ

created๋ฅผ ์•ˆ๊ฑฐ์น˜๋Š” ์ปดํฌ๋„ŒํŠธ๋Š” ์ธ์Šคํ„ด์Šค๋กœ ๋‚จ์•„์žˆ์–ด ๋กœ๋”ฉ์ด ์˜ค๋ž˜ ๊ฑธ๋ฆฌ์ง€ ์•Š์œผ๋ฏ€๋กœ (๊ฑฐ์˜ ๋ฐ”๋กœ ์ „ํ™˜) loading spinner๋ฅผ ์ ์šฉํ•  ํ•„์š”๊ฐ€ ์—†๋‹ค๊ณ  ํŒ๋‹จํ–ˆ๋‹ค. ๋˜ํ•œ API ํ˜ธ์ถœ๋งˆ๋‹ค loading spinner๋ฅผ ๊ฑธ๊ณ  ์žˆ๋‹ค.

Clone this wiki locally