When I create a component using the `setup` syntax sugar, I can't get the instance of the current component
Version
3.2.26
Reproduction link
Steps to reproduce
Im sorry, SFC Playground
doesn't has console. You can open this code in your browser,.
- set
ref
to<Comp ref="compRef" />
and<SetupComp ref="setupCompRef" />
- open console,
compRef
has value, butSetupComp
doesn't
So why?
What is expected?
compRef
has value, SetupComp
also has value
What is actually happening?
compRef
has value, but SetupComp
doesn't
By the way, when I tried to debug in the browser after writing code using the setup
syntax sugar, I found myself in hell. my god
Seems to work well:
[vite] connecting...
App.vue:16 watchEffect:compRef null
App.vue:20 watchEffect:setupCompRef null
App.vue:16 watchEffect:compRef Proxy {…}[[Handler]]: Object[[Target]]: Object[[IsRevoked]]: false
App.vue:20 watchEffect:setupCompRef Proxy {__v_skip: true}[[Handler]]: Object[[Target]]: Proxy[[IsRevoked]]: false
client:206 [vite] connected.
Seems to work well:
[vite] connecting... App.vue:16 watchEffect:compRef null App.vue:20 watchEffect:setupCompRef null App.vue:16 watchEffect:compRef Proxy {…}[[Handler]]: Object[[Target]]: Object[[IsRevoked]]: false App.vue:20 watchEffect:setupCompRef Proxy {__v_skip: true}[[Handler]]: Object[[Target]]: Proxy[[IsRevoked]]: false client:206 [vite] connected.
just like this,I want to use some variables from a file that I created with the setup
. I used defineExpose
to meet my requirements