Subscribe on changes!

VNodes' refs are discarded when passed to `<component :is="vnodes" ref="custom" />`

avatar
Sep 9th 2020

Version

3.0.0-rc.10

Reproduction link

https://jsfiddle.net/mxv2r4gh/

Steps to reproduce

  • click the button

What is expected?

The watcher on viewRef should trigger

What is actually happening?

viewRef doesn't change


From https://github.com/vuejs/vue-router-next/issues/461

avatar
Sep 9th 2020

It works for a :ref binding though.

avatar
Sep 11th 2020

@CyberAP Can you post the whole code you used? It doesn't seem to work

avatar
Sep 11th 2020

The only line I changed was this:

<component :is="Component" ref="custom" />

To this:

<component :is="Component" :ref="custom" />

Do note that console.log(value.$el) takes a lot of time in JSFiddle because it prints that object in its own console. If you just log 1 it will work as expected.

avatar
Sep 11th 2020

That won't work for custom ref though, it's like omitting the ref attribute