<script>
export default {
setup() {
}
created() {
}
}
</script>
When i change to use script setup syntax, how to use created hook ?
<setup script>
// how to use created hook ?
</script>
As you can see here, there is no such thing as created
in Composition API lifecycle: https://vuejs.org/api/composition-api-lifecycle.html
Because it happens before the actual creation
All APIs listed on this page must be called synchronously during the setup() phase of a component. See Guide - Lifecycle Hooks for more details.
created
hook coming just after as shown here: https://vuejs.org/guide/essentials/lifecycle.html#lifecycle-diagram
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With