Skip to content

Commit bf78a96

Browse files
authored
Merge pull request #144 from resessh/translate-migrate-render-function-api
Migration Guide > Render Function API の翻訳
2 parents e67072f + 63af1a9 commit bf78a96

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

src/guide/migration/render-function-api.md

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,41 @@ badges:
33
- breaking
44
---
55

6-
# Render Function API <MigrationBadges :badges="$frontmatter.badges" />
6+
# Render 関数 API <MigrationBadges :badges="$frontmatter.badges" />
77

8-
## Overview
8+
## 概要
99

10-
This change will not affect `<template>` users.
10+
この変更は `<template>` の利用には影響しません。
1111

12-
Here is a quick summary of what has changed:
12+
以下が変更の簡単な概要になります:
1313

14-
- `h` is now globally imported instead of passed to render functions as an arguments
15-
- render function arguments changed to be more consistent between stateful and functional components
16-
- VNodes now have a flat props structure
14+
- `h` render 関数の引数ではなく、グローバルにインポートされます。
15+
- render 関数の引数はステートフルコンポーネントと関数型コンポーネントの間でより一貫性があるものに変更されました。
16+
- VNode のプロパティの構造がフラットになりました。
1717

18-
For more information, read on!
18+
詳しい情報は以下を読んでください。
1919

20-
## Render Function Argument
20+
## Render 関数の引数
2121

22-
### 2.x Syntax
22+
### 2.x での構文
2323

24-
In 2.x, the `render` function would automatically receive the `h` function (which is a conventional alias for `createElement`) as an argument:
24+
2.x では、 `render` 関数は自動的に `h` 関数(`createElement` の従来のエイリアス)を引数として受け取るようになっていました:
2525

2626
```js
27-
// Vue 2 Render Function Example
27+
// Vue 2 Render 関数の例
2828
export default {
2929
render(h) {
3030
return h('div')
3131
}
3232
}
3333
```
3434

35-
### 3.x Syntax
35+
### 3.x での構文
3636

37-
In 3.x, `h` is now globally imported instead of being automatically passed as an argument.
37+
3.x では、 `h` は自動的に引数に渡されるのではなくグローバルにインポートされます。
3838

3939
```js
40-
// Vue 3 Render Function Example
40+
// Vue 3 Render 関数の例
4141
import { h } from 'vue'
4242

4343
export default {
@@ -47,24 +47,24 @@ export default {
4747
}
4848
```
4949

50-
## Render Function Signature Change
50+
## Render 関数のシグネチャの変更
5151

52-
### 2.x Syntax
52+
### 2.x での構文
5353

54-
In 2.x, the `render` function automatically received arguments such as `h`.
54+
2.x では、 `render` 関数は自動的に `h` として引数を受け取っていました。
5555

5656
```js
57-
// Vue 2 Render Function Example
57+
// Vue 2 Render 関数の例
5858
export default {
5959
render(h) {
6060
return h('div')
6161
}
6262
}
6363
```
6464

65-
### 3.x Syntax
65+
### 3.x での構文
6666

67-
In 3.x, since the `render` function no longer receives any arguments, it will primarily be used inside of the `setup()` function. This has the added benefit of gaining access to reactive state and functions declared in scope, as well as the arguments passed to `setup()`.
67+
3.x では、 `render` 関数がなんの引数も受け取らなくなるので、主に `setup()` 関数の中で利用されます。この変更は`setup()` 関数に渡された引数だけでなく、スコープの中で宣言されたリアクティブな状態や関数にアクセスできるという追加の利点があります。
6868

6969
```js
7070
import { h, reactive } from 'vue'
@@ -79,7 +79,7 @@ export default {
7979
state.count++
8080
}
8181

82-
// return the render function
82+
// render 関数を返す
8383
return () =>
8484
h(
8585
'div',
@@ -92,13 +92,13 @@ export default {
9292
}
9393
```
9494

95-
For more information on how `setup()` works, see our [Composition API Guide](/guide/composition-api-introduction.html).
95+
`setup()` がどう動作するかについての詳しい情報は、[コンポジション API ガイド](/guide/composition-api-introduction.html)を参照してください。
9696

97-
## VNode Props Format
97+
## VNode のプロパティの形式
9898

99-
### 2.x Syntax
99+
### 2.x での構文
100100

101-
In 2.x, `domProps` contained a nested list within the VNode props:
101+
2.x では、VNode のプロパティの中に `domProps` がネストされたリストとして含まれていました:
102102

103103
```js
104104
// 2.x
@@ -112,12 +112,13 @@ In 2.x, `domProps` contained a nested list within the VNode props:
112112
}
113113
```
114114

115-
### 3.x Syntax
115+
### 3.x での構文
116116

117117
In 3.x, the entire VNode props structure is flattened. Using the example from above, here is what it would look like now.
118+
3.x では、全ての VNode のプロパティ構造はフラットになりました。上記の例が下記のようになります。
118119

119120
```js
120-
// 3.x Syntax
121+
// 3.x での構文
121122
{
122123
class: ['button', 'is-outlined'],
123124
style: { color: '#34495E' },
@@ -128,16 +129,16 @@ In 3.x, the entire VNode props structure is flattened. Using the example from ab
128129
}
129130
```
130131

131-
## Migration Strategy
132+
## 移行の戦略
132133

133-
### Library Authors
134+
### ライブラリの著者
134135

135-
`h` being globally imported means that any library that contains Vue components will include `import { h } from 'vue'` somewhere. As a result, this creates a bit of overhead since it requires library authors to properly configure the externalization of Vue in their build setup:
136+
`h` がグローバルにインポートされるということは、Vue コンポーネントを含むライブラリはどれも `import { h } from 'vue'` という記述がどこかに含まれていることを意味します。結果として、ライブラリの著者はビルドにおいて適切に Vue の外部化を設定することが求められるので、少し手間が増えます:
136137

137-
- Vue should not be bundled into the library
138-
- For module builds, the import should be left alone and be handled by the end user bundler
139-
- For UMD / browser builds, it should try the global Vue.h first and fallback to require calls
138+
- Vue はライブラリの中にバンドルされるべきではない
139+
- モジュール向けのビルドでは、インポートはそのまま残されてエンドユーザのバンドラーで処理されるべきです。
140+
- UMD / ブラウザー環境向けのビルドでは、まずグローバルの Vue.h を試して、フォールバックとして require を呼ぶべきです。
140141

141-
## Next Steps
142+
## 次のステップ
142143

143-
See [Render Function Guide](/guide/render-function) for more detailed documentation!
144+
[Render 関数ガイド](/guide/render-function) でもっと詳しいドキュメントを参照してください!

0 commit comments

Comments
 (0)