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
Copy file name to clipboardExpand all lines: src/tutorial/src/step-2/description.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,16 @@
1
-
# Declarative Rendering
1
+
# 宣言的レンダリング
2
2
3
3
<divclass="sfc">
4
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.
5
+
エディターに表示されているのは、Vue Single File Component (SFC) です。SFC は再利用可能な自己完結型のコードブロックであり、一緒に属する HTML、CSS、JavaScript をカプセル化して `.vue`ファイル内に記述します。
6
6
7
7
</div>
8
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.
9
+
Vue の中核となる機能は**宣言的レンダリング**です。HTML を拡張したテンプレート構文を用いて、JavaScript の状態に基づいて HTML がどのように見えるかを記述することができます。状態が変更されると、HTML は自動的に更新されます。
10
10
11
11
<divclass="composition-api">
12
12
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:
13
+
変更されたときに更新のトリガーとなるような状態は**リアクティブ**とみなされます。Vue の `reactive()` API を使用してリアクティブな状態を宣言することができます。`reactive()`で生成されるオブジェクトは JavaScript の [プロキシ](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Proxy)であり、通常のオブジェクトと同様に動作します:
14
14
15
15
```js
16
16
import { reactive } from'vue'
@@ -23,7 +23,7 @@ console.log(counter.count) // 0
23
23
counter.count++
24
24
```
25
25
26
-
`reactive()`only works on objects (including arrays and built-in types like `Map`and`Set`). `ref()`, on the other hand, can take any value type and create an object that exposes the inner value under a `.value`property:
Details on `reactive()`and`ref()`are discussed in <atarget="_blank"href="/guide/essentials/reactivity-fundamentals.html">Guide - Reactivity Fundamentals</a>.
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:
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:
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:
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.
The `message`property will be made available in the template. This is how we can render dynamic text based on the value of `message`, using mustaches syntax:
0 commit comments