B
B
BonBon Slick2020-05-12 20:55:11
typescript
BonBon Slick, 2020-05-12 20:55:11

Best way to initialize default values?

one

export default class App extends Vue {
        private title: string = 'My Vue and CosmosDB Heroes App';

       constructor() {
            super();
        }


2
export default class App extends Vue {
        private title: string;

        constructor() {
            super();
this.title = 'My Vue and CosmosDB Heroes App';
        }


3
export default class App extends Vue {
        private title: string;

        constructor() {
            super();
        }

mounted(){
    this.title = 'My Vue and CosmosDB Heroes App';
}


Which of the options, when and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Aetae, 2020-05-15
@BonBonSlick

The first case is reactive, the second and third are not. To understand what works and in what order, it is enough to conduct an experiment. Well, or sift through the sources of vue-class-component. Which is easier for you.)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question