๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

emits

(1)
[Vue .js] Composition API : props, emits ์‚ฌ์šฉ๋ฒ• composition API porps, emits ์‚ฌ์šฉ๋ฒ• Vue์— ์ถ”๊ฐ€๋œ composition API๋Š” Vue2์—์„œ์˜ option API๋ณด๋‹ค ์ปดํฌ๋„ŒํŠธ๋ฅผ ์กฐ๊ธˆ ๋” ๋…๋ฆฝ์ ์œผ๋กœ ๋งŒ๋“ค๊ธฐ ์œ ๋ฆฌํ•˜๋‹ค.๊ด€์‹ฌ์‚ฌ์˜ ๋ถ„๋ฆฌ(์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ๋Š” ๋ฐ์ดํ„ฐ ์ปจํ…Œ์ด๋„ˆ ์—ญํ• ๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ์ง์ ‘ ์กฐ์ž‘, ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ์กฐ์ž‘ํ•˜์ง€ ์•Š๊ณ  ํ‘œํ˜„๋งŒ์„ ๋‹ด๋‹น)๋ฅผ ํ†ตํ•ด ์ปดํฌ๋„ŒํŠธ์˜ ์žฌ์‚ฌ์šฉ๋ฅ ์„ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค.props์™€ emits ์‚ฌ์šฉ๋ฒ• ์˜ˆ์‹œ์•„๋ž˜์˜ˆ์‹œ๋Š” App.vue ์•ˆ์—์„œ TodoList.vue ์ปดํฌ๋„ŒํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ด๋‹ค. App.vue ์ƒ์œ„ ์ปดํฌ๋„ŒํŠธ์ธ App.vue์—์„œ ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ์—๊ฒŒ datadls props๋ฅผ ๋‚ด๋ ค์ฃผ๊ณ  ํ•˜์œ„ ์ปดํฌ๋„ŒํŠธ์—๊ฒŒ ์ด๋ฒคํŠธ์ธ emits์„ ๋ฐ›๋Š”๋‹ค. ํ•˜์œ„์ปดํฌ๋„ŒํŠธ(TodoList.vue)์˜ todoItemsPro..

728x90