Add an example of using defineComponent in a single-file component #862
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 fromconst Component =
toexport 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 establishesexport default
as a relevant concept.