Technically everything inside the script
block is executed at component instantiation, before mounting. Additionally as the documentation states beforeUpdate
will run before the first mount as well.
So, given this code:
<script>
import { beforeUpdate, onMount }
console.log('instantiating')
beforeUpdate(() => console.log('beforeUpdate'))
onMount(() => console.log('onMount'))
</script>
the output would be
instantiating
beforeUpdate
onMount
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…