Skip to content

Commit b378e33

Browse files
committed
improve tutorial early steps per feedback
1 parent 8872edc commit b378e33

File tree

3 files changed

+41
-9
lines changed

3 files changed

+41
-9
lines changed

Diff for: src/tutorial/TutorialRepl.vue

+11
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,21 @@ footer a {
209209
margin: 1em 0;
210210
}
211211
212+
.vt-doc :deep(h2) {
213+
font-size: 1.1em;
214+
margin: 1.2em 0 0.5em;
215+
padding: 0;
216+
border-top: none;
217+
}
218+
212219
.vt-doc :deep(.header-anchor) {
213220
display: none;
214221
}
215222
223+
.vt-doc :deep(summary) {
224+
cursor: pointer;
225+
}
226+
216227
.hint {
217228
padding-top: 1em;
218229
}

Diff for: src/tutorial/src/step-1/description.md

+16-3
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22

33
Welcome to the Vue tutorial!
44

5-
The goal of this tutorial is to quickly give you an experience of what it feels like to work with Vue, right in the browser. It does **not** aim to be comprehensive, so after you complete it, make sure to also read the <a target="_blank" href="/guide/introduction.html">Guide</a> which covers each topic in more details.
5+
The goal of this tutorial is to quickly give you an experience of what it feels like to work with Vue, right in the browser. It does not aim to be comprehensive, and you don't need to understand everything before moving on. However, after you complete it, make sure to also read the <a target="_blank" href="/guide/introduction.html">Guide</a> which covers each topic in more details.
66

7-
Vue offers two API styles: Options API and Composition API. This tutorial is designed to work for both - you can choose your preferred style using the **API Preference** switches at the top. <a target="_blank" href="/guide/introduction.html#api-styles">Learn more about API styles</a>.
7+
## Prerequisites
88

9-
You can also switch between SFC-mode or HTML-mode. The former will show code examples in <a target="_blank" href="/guide/introduction.html#single-file-components">Single-File Component</a> (SFC) format, which is what most developers use when they use Vue with a build step. HTML-mode shows usage without a build step.
9+
The tutorial assumes basic familiarity with HTML, CSS and JavaScript. If you are totally new to front development, it might not be the best idea to jump right into a framework as your first step - grasp the basics then come back! Prior experience with other frameworks helps, but is not required.
10+
11+
## How to Use This Tutorial
1012

1113
You can edit the code <span class="wide">on the right</span><span class="narrow">below</span> and see the result update instantly. Each step will introduce a core feature of Vue, and you will be expected to complete the code to get the demo working. If you get stuck, you will have a "Show me!" button that reveals the working code for you. Try not to rely on it too much - you'll learn faster by figuring things out on your own.
1214

15+
If you are an experienced developer coming from Vue 2 or other frameworks, there are a few settings you can tweak to make the best use of this tutorial. If you are a beginner, it's recommended to go with the defaults.
16+
17+
<details>
18+
<summary>Tutorial Setting Details</summary>
19+
20+
- Vue offers two API styles: Options API and Composition API. This tutorial is designed to work for both - you can choose your preferred style using the **API Preference** switches at the top. <a target="_blank" href="/guide/introduction.html#api-styles">Learn more about API styles</a>.
21+
22+
- You can also switch between SFC-mode or HTML-mode. The former will show code examples in <a target="_blank" href="/guide/introduction.html#single-file-components">Single-File Component</a> (SFC) format, which is what most developers use when they use Vue with a build step. HTML-mode shows usage without a build step.
23+
24+
</details>
25+
1326
Ready? Click "Next" to get started.

Diff for: src/tutorial/src/step-2/description.md

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
# Declarative Rendering
22

3-
The core feature of Vue is **declarative rendering**: using a template syntax that extends HTML, we can keep the HTML view in sync with the JavaScript state, automatically.
3+
<div class="sfc">
4+
5+
What you see in the editor is a Vue Single File Component (SFC). An SFC is a reusable self-contained block of code that encapsulates HTML, CSS and JavaScript that belong together, written inside a `.vue` file.
6+
7+
</div>
8+
9+
The core feature of Vue is **declarative rendering**: using a template syntax that extends HTML, we can describe how the HTML should look like based on JavaScript state. When the state changes, the HTML updates automatically.
410

511
<div class="composition-api">
612

7-
We can declare reactive state using `reactive()`. Objects created from `reactive()` are proxies that work just like normal objects:
13+
State that can trigger updates when changed are considered **reactive**. We can declare reactive state using Vue's `reactive()` API. Objects created from `reactive()` are JavaScript [Proxies](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) that work just like normal objects:
814

915
```js
1016
import { reactive } from 'vue'
@@ -32,13 +38,13 @@ Details on `reactive()` and `ref()` are discussed in <a target="_blank" href="/g
3238

3339
<div class="sfc">
3440

35-
Variables declared in the `<script setup>` block can be used directly in the template. This is how we can render dynamic text based on the value of the `state` object and `message` ref, using mustaches syntax:
41+
Reactive state declared in the component's `<script setup>` block can be used directly in the template. This is how we can render dynamic text based on the value of the `state` object and `message` ref, using mustaches syntax:
3642

3743
</div>
3844

3945
<div class="html">
4046

41-
A component's state should be declared inside its `setup()` function, and returned using an object:
47+
The object being passed to `createApp()` is a Vue component. A component's state should be declared inside its `setup()` function, and returned using an object:
4248

4349
```js{2,5}
4450
setup() {
@@ -51,7 +57,7 @@ setup() {
5157
}
5258
```
5359

54-
Properties in the returned object will be exposed to the template. This is how we can render dynamic text based on the value of `message`, using mustaches syntax:
60+
Properties in the returned object will be made available in the template. This is how we can render dynamic text based on the value of `message`, using mustaches syntax:
5561

5662
</div>
5763

@@ -66,7 +72,9 @@ Notice how we did not need to use `.value` when accessing the `message` ref in t
6672

6773
<div class="options-api">
6874

69-
We can declare reactive state using the `data` option, which should be a function that returns an object:
75+
State that can trigger updates when changed are considered **reactive**. In Vue, reactive state is held in components. In the example code, the object being passed to `createApp()` is a component.
76+
77+
We can declare reactive state using the `data` component option, which should be a function that returns an object:
7078

7179
<div class="sfc">
7280

0 commit comments

Comments
 (0)