Subscribe on changes!

Fetching child component instances with refs in script setup is not available

avatar
May 11th 2021

Version

3.1.0-beta.2

Steps to reproduce

When a child component uses Script Setup,I try to get the child instance through refs, I get an empty object

//parent.vue

template> child ref="sonRef" /> button @click="handle">get</button template>



//child.vue

What is expected?

When a child component uses Script Setup, an instance of the child component can be obtained through refs

What is actually happening?

You can't get a child component instance when a child uses Script Setup, but you can get instance data when a child uses DefineComponent ({setUp (){}})

avatar
May 11th 2021

Open a new issue with a boiled down reproduction at https://sfc.vuejs.org See https://new-issue.vuejs.org/?repo=vuejs/vue-next#why-repro

avatar
Jun 16th 2021

@posva Please see this.

avatar
Jun 16th 2021

image