I'm just starting a Vue TypeScript project 3 hour ago,
Just finishing setting rules eslint and tslint and make the "formatter" does the "rules" want and I'm happy about it,
And now I just want to know how to use created / mounted that will call function when the app / page refresh, because I read the documenttation and try it with no luck.
<template>
<v-app>
<v-main>
<p>{{ name }}</p>
</v-main>
</v-app>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
@Component({
components: {},
})
export default class App extends Vue {
name: string = 'hello';
constructor() {
super();
this.test();
}
onClick() {
console.log('clicked');
this.name = 'Clicked Hello';
}
test = (): void => {
this.name = 'Hello Wrold!';
console.log('this is test and called');
};
mounted = (): void => {
this.test();
};
created = (): void => {
this.test();
};
}
</script>
I just want to call a function from the start, I know this is very basic, but yeah it's not working for me and I need help for it.
the code from tutorial and answer is work, I just need to re-open the project and start again. But also I use the different answer because less warning for me.