Skip to content

Added options for object-based props definition in API #2028

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

Merged
merged 5 commits into from
Feb 24, 2019

Conversation

NataliaTepluhina
Copy link
Member

I created a draft API entry describing all possible options we can have with Object-syntax prop. Also, I fixes a link @phanan mentioned in #2027.

Close #2027

- fixed a link to props section
Copy link
Member

@LinusBorg LinusBorg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome work, and so fast! Thanks!

I noted two minor things.

@NataliaTepluhina
Copy link
Member Author

Thanks for the blazing fast review, @LinusBorg! I've added some requested changes

Copy link
Member

@phanan phanan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! I have a couple of suggestions – do you think they make sense?

phanan and others added 3 commits February 23, 2019 15:05
Co-Authored-By: NataliaTepluhina <[email protected]>
Co-Authored-By: NataliaTepluhina <[email protected]>
Co-Authored-By: NataliaTepluhina <[email protected]>
@NataliaTepluhina
Copy link
Member Author

Thanks @phanan! Yes, I agree, I forgot to mention warnings are thrown only on dev environment
Suggestions applied 🙇‍♀️

@phanan
Copy link
Member

phanan commented Feb 24, 2019

Looks great! I think it's good enough to merge now 👍

@phanan phanan merged commit 3119f1d into vuejs:master Feb 24, 2019
phanan pushed a commit to phanan-forks/vuejs.org that referenced this pull request Mar 14, 2019
* feat: add API entry on props options

- fixed a link to props section

* fix: moved a link and added read-more types link

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>
phanan pushed a commit to phanan-forks/vuejs.org that referenced this pull request Mar 20, 2019
* feat: add API entry on props options

- fixed a link to props section

* fix: moved a link and added read-more types link

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>

* Update src/v2/api/index.md

Co-Authored-By: NataliaTepluhina <[email protected]>
@@ -509,6 +509,15 @@ type: api

A list/hash of attributes that are exposed to accept data from the parent component. It has an Array-based simple syntax and an alternative Object-based syntax that allows advanced configurations such as type checking, custom validation and default values.

With Object-based syntax, you can use following options:
- **type:** can be one of the following native constructors: `String`, `Number`, `Boolean`, `Array`, `Object`, `Date`, `Function`, `Symbol`, any custom constructor function or an array of those. Will check if a prop has a given type, and will throw a warning if it doesn't. [More information](../guide/components-props.html#Prop-Types) on prop types.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it better to wrap the object keys type, default, required and validator with backquotes? Because they are kinds of actual code somehow. 🤔
I will give a PR if you all don't mind.
Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Document all options for object-based props definition in API
4 participants