###### tags: `Vue` # 【Vue】生命週期  ## 註冊與使用 ```js= <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
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up