Bootstrap

Vue3+ts学习笔记2

<script setup lang="ts">
import {onBeforeMount,onMounted,onBeforeUpdate,onUpdated,onBeforeUnmount,onUnmounted} from 'vue'

onBeforeMount(()=>{
    console.log('---挂载之前---')
})

onMounted(()=>{
   console.log('---挂载---')
})

onBeforeUpdate(()=>{
  console.log('---更新之前---')
})

onUpdated(()=>{
  console.log('---更新---')
})

onBeforeUnmount(()=>{
  console.log('---卸载之前---')
})

onUnmounted(()=>{
  console.log('---卸载---')
})

</script>

<template>
  <div>
    <h2>Vue3的生命周期函数</h2>
  </div>
</template>

<style lang="scss"></style>

;