Subscribe on changes!

Components with default prop value for v-model that are not using one aren't being updated after an update event is emitted

avatar
Feb 13th 2021

Version

3.0.5

Reproduction link

https://jsfiddle.net/6x0yahsb/

Steps to reproduce

  1. click update button on the bound test component
  2. watch input getting updated
  3. click update button on the default test component
  4. watch input not being updated

What is expected?

The default component - component which has a default prop value and is not bound with v-model:value should be updated as well.

What is actually happening?

The default component is not being updated whilst the component with v-model:value gets updated correctly.

avatar
Feb 13th 2021

Why do you think this is not up to expectations? Obviously, you need to use v-model.

avatar
Feb 13th 2021

Then what in case I have a component that has two v-models but sometimes I only care about one value? If I don't pass the second v-model, the component wouldn't work internally. And creating a data value for every value I don't care of every instance of this component seems like a big overhead to me.

avatar
Feb 13th 2021

Yes, you need a data property. You can create a composable to handle it. I created a mixin with Vue 2 in mind to handle this case: https://github.com/posva/vue-prop-data-fallback