Skip to content

Commit 4ad288b

Browse files
committed
Translate: Migration Guide > Data Option
1 parent a2434c4 commit 4ad288b

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

src/guide/migration/data-option.md

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
---
2-
title: Data Option
32
badges:
43
- breaking
54
---
65

7-
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
6+
# Data オプション <MigrationBadges :badges="$frontmatter.badges" />
87

9-
## Overview
8+
## 概要
109

11-
- **BREAKING**: `data` component option declaration no longer accepts a plain JavaScript `object` and expects a `function` declaration.
10+
`data` コンポーネントオプション宣言はプレーンな JavaScript `object` を受け入れず、`function` 宣言を期待します。
1211

13-
## 2.x Syntax
12+
## 2.x での構文
1413

15-
In 2.x, developers could define the `data` option with either an `object` or a `function`.
14+
2.x では、`data` オプションは `object` `function` のどちらか一方で定義できました。
1615

17-
For example:
16+
:
1817

1918
```html
20-
<!-- Object Declaration -->
19+
<!-- オブジェクト宣言 -->
2120
<script>
2221
const app = new Vue({
2322
data: {
@@ -26,7 +25,7 @@ For example:
2625
})
2726
</script>
2827

29-
<!-- Function Declaration -->
28+
<!-- 関数宣言 -->
3029
<script>
3130
const app = new Vue({
3231
data() {
@@ -38,13 +37,13 @@ For example:
3837
</script>
3938
```
4039

41-
Though this provided some convenience in terms of root instances having a shared state, this has led to confusion due to the fact that its only possible on the root instance.
40+
これは共有状態を持っているルートインスタンスに関してはある程度の利便性をもたらしましたが、ルートインスタンスでのみ可能であるという事実のため混乱を招きました。
4241

43-
## 3.x Update
42+
## 3.x での更新
4443

45-
In 3.x, the `data` option has been standardized to only accept a `function` that returns an `object`.
44+
3.x では、 `data` オプションは `object` を返す `function` 宣言のみ受け入れるよう標準化されました。
4645

47-
Using the example above, there would only be one possible implementation of the code:
46+
上記を例にすると、コードの可能な実装は1つだけです:
4847

4948
```html
5049
<script>
@@ -60,9 +59,9 @@ Using the example above, there would only be one possible implementation of the
6059
</script>
6160
```
6261

63-
## Migration Strategy
62+
## 移行の戦略
6463

65-
For users relying on the object declaration, we recommend:
64+
オブジェクト宣言を利用しているユーザーには以下を推奨します:
6665

67-
- Extracting the shared data into an external object and using it as a property in `data`
68-
- Rewrite references to the shared data to point to a new shared object
66+
- 共有データを外部オブジェクトとして抽出し、それを `data` のプロパティとして使う
67+
- 共有データへの参照、新しい共有オブジェクトを指すようにを書き換える

0 commit comments

Comments
 (0)