Skip to content

Migration > Functional Components の翻訳を追従 #246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/guide/migration/functional-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default {

または、単一ファイルコンポーネントの `<template>` を好む人向けに:

```js
// Vue 2 での <template> を使用した関数型コンポーネントの例
```vue
<!-- Vue 2 での <template> を使用した関数型コンポーネントの例 -->
<template functional>
<component
:is="`h${props.level}`"
Expand Down Expand Up @@ -87,14 +87,14 @@ export default DynamicHeading

### 単一ファイルコンポーネント (SFC)

3.x では、ステートフルコンポーネントと関数型コンポーネントのパフォーマンスの差は大幅に減少し、ほとんどのユースケースでは重要ではないでしょう。その結果、単一ファイルコンポーネントで `functional` を使用している開発者の移行方法は、その属性を削除することです。 追加の作業は必要ありません
3.x では、ステートフルコンポーネントと関数型コンポーネントのパフォーマンスの差は大幅に減少し、ほとんどのユースケースでは重要ではないでしょう。その結果、単一ファイルコンポーネントで `functional` を使用している開発者の移行方法は、この属性を削除して、 `props` を `$props` に、 `attrs` を `$attrs` にすべての参照を変更することになります

先ほどの `<dynamic-heading>` の例を使うと、次のようになります。

```js{1}
```vue{1,3,4}
<template>
<component
v-bind:is="`h${props.level}`"
v-bind:is="`h${$props.level}`"
v-bind="$attrs"
/>
</template>
Expand Down