Try   HackMD
tags: Vue

【Vue】生命週期

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

註冊與使用

<script setup> import { onMounted } from 'vue' onMounted(() => { console.log(`the component is now mounted.`) }) </script>
  • 必須是同步的
setTimeout(() => { onMounted(() => { //this won't work. }) }, 100)
  • 可以在 setup 外使用
  • 在 composition api 中 created() 是 setup()

所有的 api: https://vuejs.org/api/composition-api-lifecycle.html