You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix grammatical errors and introduce app.component() in introduction.md (#1388)
* Fixed grammatical error in theme-data.js
In the Flatlogic description, the phrase "how real applications is built" is grammatically incorrect since "applications" is a plural noun but "is" refers to a singular noun. I changed it to "how real applications are built."
In the PrimeVue description, the phrase "look&feel" (which lacked spaces between the words and punctuation) has been changed to "look & feel".
* Update theme-data.js
In the Flatlogic description, "Check the admin dashboard templates" has been changed to "Check out the admin dashboard templates."
* Fix grammar and introduce the component method
* Add missing 'a'
* Update introduction to include reviewer's changes
Removed all use of the app.component() method from the introduction so as to not confuse readers.
Copy file name to clipboardExpand all lines: src/guide/introduction.md
+14-11Lines changed: 14 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -52,7 +52,7 @@ const Counter = {
52
52
Vue.createApp(Counter).mount('#counter')
53
53
```
54
54
55
-
We have already created our very first Vue app! This looks pretty similar to rendering a string template, but Vue has done a lot of work under the hood. The data and the DOM are now linked, and everything is now **reactive**. How do we know? Take a look at the example below where `counter` property increments every second and you will see how rendered DOM changes:
55
+
We have already created our very first Vue app! This looks pretty similar to rendering a string template, but Vue has done a lot of work under the hood. The data and the DOM are now linked, and everything is now **reactive**. How do we know? Take a look at the example below where the `counter` property increments every second and you will see how the rendered DOM changes:
It's easy to toggle the presence of an element, too:
161
+
It's easy to toggle the presence of an element too:
162
162
163
163
```html
164
164
<divid="conditional-rendering">
@@ -220,7 +220,7 @@ The component system is another important concept in Vue, because it's an abstra
220
220
221
221

222
222
223
-
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:
223
+
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 the `app` object and we define it in the parent's `components` option:
224
224
225
225
```js
226
226
constTodoItem= {
@@ -251,10 +251,10 @@ Now you can compose it in another component's template:
251
251
But this would render the same text for every todo, which is not super interesting. We should be able to pass data from the parent scope into child components. Let's modify the component definition to make it accept a [prop](component-basics.html#passing-data-to-child-components-with-props):
252
252
253
253
```js
254
-
app.component('todo-item', {
254
+
constTodoItem= {
255
255
props: ['todo'],
256
256
template:`<li>{{ todo.text }}</li>`
257
-
})
257
+
}
258
258
```
259
259
260
260
Now we can pass the todo into each repeated component using `v-bind`:
@@ -278,6 +278,11 @@ Now we can pass the todo into each repeated component using `v-bind`:
278
278
```
279
279
280
280
```js
281
+
constTodoItem= {
282
+
props: ['todo'],
283
+
template:`<li>{{ todo.text }}</li>`
284
+
}
285
+
281
286
constTodoList= {
282
287
data() {
283
288
return {
@@ -287,22 +292,20 @@ const TodoList = {
287
292
{ id:2, text:'Whatever else humans are supposed to eat' }
This is a contrived example, but we have managed to separate our app into two smaller units, and the child is reasonably well-decoupled from the parent via the props interface. We can now further improve our `<todo-item>` component with more complex template and logic without affecting the parent app.
308
+
This is a contrived example, but we have managed to separate our app into two smaller units, and the child is reasonably well-decoupled from the parent via the props interface. We can now further improve our `<todo-item>` component with a more complex template and logic without affecting the parent app.
306
309
307
310
In a large application, it is necessary to divide the whole app into components to make development manageable. We will talk a lot more about components [later in the guide](component-basics.html), but here's an (imaginary) example of what an app's template might look like with components:
0 commit comments