beforeCreate() -> 使用 steup()
created() -> 使用 steup()
beforeMount() ->使用 onBeforeMount()
mounted() ->使用 onMounted()
beforeUpdate() ->使用 onBeforeUpdate()
updated() ->使用 onUpdated()
beforeDestroy() ->使用 onBeforeUnmount()
destroyed() ->使用 onUnmounted()
errorCaptured() ->使用 onErrorCaptured()
<template>
<div class="app">
<h1>钩子函数</h1>
</div>
</template>
<script>
import { onMounted,onBeforeUpdate,onUpdated,onBeforeUnmount,onUnmounted,onErrorCaptured } from 'vue'
export default {
setup() {
onBeforeMount(() => {
})
onMounted(() => {
})
onBeforeUpdate(() => {
})
onUpdated(() => {
})
onBeforeUnmount(() => {
})
onUnmounted(() => {
})
onErrorCaptured(() => {
})
}
}
</script>
<style></style>