I have a component that is included on a page in Nuxt.
This component has the following lifecycle hooks:
<script>
export default {
name: 'MyComponent',
created() { alert('oh hai!') },
mounted() { alert('oh hai again!') }
}
</script>
This works fine in development. However when I export the site full static (nuxt generate) the code in the created and mounted hooks does not run -- the alerts never appear when the page is loaded.
I feel like I must be missing something obvious, but I can't figure it out. Do the created/mounted lifecycle hooks get called on components if they are used on full static nuxt sites? If not, what is the recommended way to initialize the code that is used to control a component?