D
D
dominy2021-09-21 18:26:12
Vue.js
dominy, 2021-09-21 18:26:12

How to get variable from data inside created vue 3?

hello i have

data() {
    return {
      var: 1,
    };
  },
created(){
this.var=2;
}

but it doesn't work because this==undefined;

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2021-09-22
@dominy

Everything is working:

But, if we take Vue 3, then it’s better to immediately switch to the Composition API.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question