Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kuanyui opened this issue Mar 5, 2021 · 1 comment · Fixed by #3363
Closed
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working

Comments

@kuanyui
Copy link

kuanyui commented Mar 5, 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

@kuanyui kuanyui changed the title Component's props doesn't validate correctly when required & default are specified, but nothing is passed to that component. Component's props doesn't validate a property with required & default specified correctly Mar 5, 2021
@HcySunYang HcySunYang linked a pull request Mar 5, 2021 that will close this issue
@HcySunYang HcySunYang added 🐞 bug Something isn't working 🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. labels Mar 5, 2021
@HcySunYang
Copy link
Member

This can also be fixed in #3363

@github-actions github-actions bot locked and limited conversation to collaborators Oct 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🔨 p3-minor-bug Priority 3: this fixes a bug, but is an edge case that only affects very specific usage. 🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants