How to use the created hook in the setup script
P粉549412038
2023-08-25 18:09:05
<p><pre class="brush:php;toolbar:false;"><script>
export default {
setup() {
}
created() {
}
}
</script></pre>
<p>How do I use the hook I created when I change to using script settings syntax? </p>
<pre class="brush:php;toolbar:false;"><setup script>
// how to use created hook?
</script></pre></p>
As you can see here, there is no such thing as "create" in the Composition API lifecycle: https://vuejs.org/api/composition-api-lifecycle.html
Because it happens before actual creation
created
The hook follows as follows: https://vuejs.org/guide/essentials/lifecycle.html#lifecycle-diagram