Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/guide/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,12 +223,16 @@ The component system is another important concept in Vue, because it's an abstra
In Vue, a component is essentially an instance with pre-defined options. 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:

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

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

// Create Vue application
const app = Vue.createApp({
components: {
TodoItem // Register a new component
},
... // Other properties for the component
})

// Mount Vue application
Expand Down