Skip to content

Introduction page mentions an approach to register component but shows another #1274

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

Closed
LSViana opened this issue Oct 7, 2021 · 3 comments
Closed
Labels
bug Errors and issues people encounter with the docs / repo

Comments

@LSViana
Copy link

LSViana commented Oct 7, 2021

Problem

The Introduction page for Vue 3 has a section named Composing with Components.

In the second paragraph of that section, right below the illustration of a layout pointing to a bunch of boxes, there's a paragraph with the following sentence:

Registering a component in Vue is straightforward: we create a component object as we did with App objects and we define it in parent's components option:

And the code example right below is:

// Create Vue application
const app = Vue.createApp(...)

// Define a new component called todo-item
app.component('todo-item', {
  template: `<li>This is a todo</li>`
})

// Mount Vue application
app.mount(...)

The main problem here is the inconsistency between what's mentioned in the documentation and the code sample provided.

Solution

I'd like to provide my suggestions:

  • The paragraph mentioned above should be updated to mention the .component([name], [definition]) approach; or
  • The code sample should be updated to actually use the components option when defining a Vue component.

I don't know what fits better, but I think the first option I mentioned above is better because it's simpler and we're on the introduction page. However, I'm sure these aren't the only possible solutions, my goal here is just to report the issue. 🙂

@LSViana
Copy link
Author

LSViana commented Oct 9, 2021

@skirtles-code Do you agree that what is reported above is an issue? If so, would you like me to submit a PR for that?

Otherwise, please go ahead and close the issue.

@NataliaTepluhina
Copy link
Member

@LSViana I agree that it's controversial and we should change it to the locally registered component. Would you like to create a PR to fix this? 🙏🏻

@NataliaTepluhina NataliaTepluhina added the bug Errors and issues people encounter with the docs / repo label Oct 16, 2021
@LSViana
Copy link
Author

LSViana commented Oct 24, 2021

@NataliaTepluhina I just created #1296 to fix that example.

Could you, please, take a look at that? I am not sure my new example is very good, then feel free to edit it as you see fit. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Errors and issues people encounter with the docs / repo
Projects
None yet
Development

No branches or pull requests

2 participants