Subscribe on changes!

Template refs on child components not working with `script setup` component declaration

avatar
Feb 19th 2021

Version

3.0.5

Reproduction link

https://github.com/garrlker/vue-script-setup-ref

Steps to reproduce

  1. npm i
  2. npm run dev
  3. localhost:3000
  4. Check your browser console

What is expected?

Console to have ref value printed

What is actually happening?

{} is printed to console


Heres a separate repo someone in the Vite discord created while I was debugging. https://github.com/jacobclevenger/vue-component-ref

Following the same steps from above, you will see refs printed into the console properly in their example.

I also tried creating components in different ways from the docs and the refs printed properly in each one. Only the script setup syntax didn't work properly.

avatar
Feb 19th 2021

Duplicate of #3228