Skip to content

Add an example of using defineComponent in a single-file component #862

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 1 commit into from
Feb 24, 2021

Conversation

skirtles-code
Copy link
Contributor

The current example that introduces defineComponent is not using an SFC. This seems to be causing some confusion, so I've added an extra example that shows the SFC equivalent. The jump from const Component = to export default seems to be one that beginners struggle to make when referring to this page of the docs (based on what I've observed on Discord).

SFCs are already discussed earlier on the page, so this isn't introducing a new concept.

I would also note that the two examples at the bottom of the page suddenly switch to using export default. While that doesn't necessarily mean they are SFCs, I think that switch is potentially confusing for anyone trying to follow along. I don't know whether my new example helps much but at least it establishes export default as a relevant concept.

@NataliaTepluhina NataliaTepluhina merged commit 8eaf11b into vuejs:master Feb 24, 2021
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.

2 participants