Skip to content

Commit d1489eb

Browse files
committed
Migration Guide > v-for Array Refs の翻訳 vuejs-jp#107
1 parent 2524627 commit d1489eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/guide/migration/array-refs.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
2-
title: v-for Array Refs
2+
title: v-forのref配列
33
badges:
44
- breaking
55
---
66

77
# {{ $frontmatter.title }} <MigrationBadges :badges="$frontmatter.badges" />
88

9-
In Vue 2, using the `ref` attribute inside `v-for` will populate the corresponding `$refs` property with an array of refs. This behavior becomes ambiguous and inefficient when there are nested `v-for`s present.
9+
Vue 2 では、`v-for` の中で `ref` 属性を記述すると、対応する `$refs` プロパティに参照の配列を入れます。この動作は、入れ子になった `v-for` がある場合、曖昧で非効率的になります。
1010

11-
In Vue 3, such usage will no longer automatically create an array in `$refs`. To retrieve multiple refs from a single binding, bind `ref` to a function which provides more flexibility (this is a new feature):
11+
Vue 3 では、この記述では `$refs` に配列が作成されなくなりました。1つのバインディングから複数の参照を取得するには、関数に `ref` をバインドします (これは新機能です)。
1212

1313
```html
1414
<div v-for="item in list" :ref="setItemRef"></div>
1515
```
1616

17-
With Options API:
17+
オプション API を使う場合
1818

1919
```js
2020
export default {
@@ -37,7 +37,7 @@ export default {
3737
}
3838
```
3939

40-
With Composition API:
40+
コンポジション API を使う場合
4141

4242
```js
4343
import { ref, onBeforeUpdate, onUpdated } from 'vue'
@@ -62,8 +62,8 @@ export default {
6262
}
6363
```
6464

65-
Note that:
65+
注意点
6666

67-
- `itemRefs` doesn't have to be an array: it can also be an object where the refs are set by their iteration keys.
67+
- `itemRefs` は配列である必要はありません。 反復キーで参照できるオブジェクトでも構いません。
6868

69-
- This also allows `itemRefs` to be made reactive and watched, if needed.
69+
- これにより、必要に応じて `itemRefs` をリアクティブにして監視することもできます。

0 commit comments

Comments
 (0)