1- Vue 3 Composition API | Vue 3 Install & Life Cycle Hooks

Опубликовано: 27 Июль 2026
на канале: izleveogren
494
11

Composition API'sini Seçenekler API'sine kıyasla eksiksiz hale getirmek için, kurulum içinde yaşam döngüsü kancalarını kaydetmenin bir yoluna da ihtiyacımız var. Bu, Vue'dan dışa aktarılan birkaç yeni işlev sayesinde mümkündür. Options API'sindeki yaşam döngüsü kancaları, Options API'siyle aynı ada sahiptir, ancak ön ekine on: örn. Mount, onMounted gibi görünür.

To make Composition API feature-complete compared to Options API, we also need a way to register lifecycle hooks inside setup. This is possible thanks to several new functions exported from Vue. Lifecycle hooks on composition API have the same name as for Options API but are prefixed with on: i.e. mounted would look like onMounted.

beforeCreate Not needed*
created Not needed*
beforeMount onBeforeMount
mounted onMounted
beforeUpdate onBeforeUpdate
updated onUpdated
beforeUnmount onBeforeUnmount
unmounted onUnmounted
errorCaptured onErrorCaptured
renderTracked onRenderTracked
renderTriggered onRenderTriggered
activated onActivated
deactivated onDeactivated

github repo: https://github.com/ademyalcin27/vue-c...

#vue3 #vuelifecyclehooks #vue3install

www.izleveogren.com