Skip to content

Modify the api doc of extends. #1379

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 2 commits into from
Mar 10, 2018
Merged

Modify the api doc of extends. #1379

merged 2 commits into from
Mar 10, 2018

Conversation

ustbhuangyi
Copy link
Contributor

Since the merge logic are the same, user can use mixins instead of extends.

@ustbhuangyi
Copy link
Contributor Author

refer to this issue: vuejs/vue#7412

@sdras
Copy link
Member

sdras commented Feb 27, 2018

I see where you're going with this and I approve, but the way that it was changed make that last sentence superfluous. Perhaps that last sentence should no longer be it's own paragraph and just say "this is similar to mixins"

@sdras
Copy link
Member

sdras commented Mar 10, 2018

I'm ready to merge this, but it looks like you'll need to rebase before we do so because the checks are failing. Thank you!

@chrisvfritz chrisvfritz merged commit afdd344 into vuejs:master Mar 10, 2018
@jungleBadger
Copy link

jungleBadger commented Dec 31, 2019

Hi there, I tried to find details about extends/mixins, after some tests and research one thing that I think that can be enhanced in the docs is the information that extends can incorporate the <template> tag in the host component as well whereas mixins cannot. (perhaps the render function, but it isn't the same, right?).

Does mixin provide the same functionality? Would it make sense to add this info to the documentation?

Another thing that I found odd is this quote:

they will be merged against the eventual options using the same option combining logic in Vue.extend(). e.g., If your mixin contains a created hook and the component itself also has one, both functions will be called.

This text is confusing to me because both extends, and mixins provide the same behavior (calling the hooks twice if needed), and this passage gives an idea this is caused by calling Vue.extend() method. I thought it might be a bug as well, but after reading through vuejs/vue#7412 I found that this is normal, so perhaps there is another window to enhance the docs as well?

Please let me know if my assumptions do make sense. I can surely open the PR with the suggested changes.

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.

4 participants