function scope creates reactive this
?? How did I not know this!
#10727
tlloydthwaites
started this conversation in
General Discussions
Replies: 3 comments
-
Can you provide an example? Generally, |
Beta Was this translation helpful? Give feedback.
0 replies
-
Beta Was this translation helpful? Give feedback.
0 replies
-
It only works inside functions, not top-level setup. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was porting a vue2 method to script setup, and I accidentally left some this.obj.prop syntax. I was surprised to find out that it worked. Further examination showed that functions have
this
bound to a reactive object representing the whole component, like the good-old vue2 days.Did everybody know this?? This is pretty huge to me as the ref.value syntax is the only thing that really trips me up in getting used to composition API. If I had of known
this
was available that would have saved a lot of work.Is this feature mentioned in the documentation somewhere and I just missed it? It makes me very happy!
Beta Was this translation helpful? Give feedback.
All reactions