生命周期
Vue3 setup 替代了 beforeCreate 和 created 两个生命周期
- 挂载
- onBeforeMount
- onMounted
- 更新
- onBeforeUpdate
- onUpdated
- 销毁
- onBeforeUnmount
- onUnmount
打印当前组件实例
<script setup lang="ts">
import {getCurrentInstance} from "vue"
const instace = getCurrentInstance();
console.log(instace);
</script>