App.vue
main.js
<template>
<h1>Lifecycle Hook 'created' Example</h1>
<p>Using the created lifecycle hook to change the 'text' data property.</p>
<p>This is the earliest point in the component's lifecycle where we can access the Vue instance properties.</p>
<p>text: <pre>'{{ text }}'</pre></p>
</template>
<script>
export default {
data() {
return {
text: 'initial text'
}
},
created(){
this.text = 'The component is now created';
}
}
</script>
<style>
pre {
display: inline;
background-color: lightgreen;
}
</style>
import { createApp } from 'vue'
import App from './App.vue'
const app = createApp(App)
app.mount('#app')