Skip to content

Commit f45aeb3

Browse files
NataliaTepluhinayyx990803
authored andcommitted
feat: added lesson 1 description
1 parent c594368 commit f45aeb3

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/tutorial/src/step-1/description.md

+21-12
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,33 @@
22

33
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
44

5-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
5+
How to make it dynamic? We need to create our first _reactive_ property `colorsNumber`
66

7-
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
8-
9-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
7+
<div class="options-api">
108

11-
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
9+
```js
10+
data() {
11+
return {
12+
colorsNumber: 3
13+
}
14+
}
15+
```
1216

13-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
17+
</div>
1418

15-
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
19+
<div class="composition-api">
1620

17-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
21+
```js
22+
import { ref } from 'vue'
23+
const colorsNumber = ref(3)
24+
```
1825

19-
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
26+
</div>
2027

21-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
28+
Now, we can use it in our template instead of a static number:
2229

23-
For now, our component renders some static data. Try to change a number 3 in the code to something different to see how the rendered result changes.
30+
```html
31+
<h2>Number of colors: {{ colorsNumber }}</h2>
32+
```
2433

25-
Let's add some dynamic data. Within component `data` return statement, add a property `colorsNumber`.
34+
Try to change the `colorsNumber` and check how it immediately updates the rendered HTML.

0 commit comments

Comments
 (0)