Component's `props` doesn't validate a property with `required` & `default` specified correctly
Version
3.0.7
Reproduction link
- Vue 2.x reproduce link: https://jsfiddle.net/xbf014gc/10/
- Vue 3.x reproduce link: https://jsfiddle.net/cafpskt5/37/
Steps to reproduce
- Define a
prop
in a component, withrequired: true
anddefault
value set. - 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.
- Vue 2.x reproduce link: https://jsfiddle.net/xbf014gc/10/ as reference
- Vue 3.x reproduce link: https://jsfiddle.net/cafpskt5/37/
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.