Subscribe on changes!

Component's `props` doesn't validate a property with `required` & `default` specified correctly

avatar
Mar 5th 2021

Version

3.0.7

Reproduction link

Steps to reproduce

  1. Define a prop in a component, with required: true and default value set.
  2. Use this component, but don't pass any prop to this component.

What is expected?

This component can access the pre-defined default value, but get a runtime warning message in console.

What is actually happening?

This component can access the pre-defined default value, and without any warning or log in console.


The expected behavior is referenced from Vue 2.x.

I don't sure whether Vue 3.x has changed its specification on this, but I think the behavior of Vue2.x is indeed more reasonable as a validator for developer.

Screenshot_20210305_123203 Screenshot_20210305_123243

avatar
Mar 5th 2021

This can also be fixed in #3363