Skip to content

Commit b51c5d8

Browse files
authored
docs: Components In-Depth > Template refs (#81)
* docs: translate Template refs * レビュー内容の反映
1 parent f09a697 commit b51c5d8

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/guide/component-template-refs.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Template refs
1+
# テンプレート参照について
22

3-
> This page assumes you've already read the [Components Basics](component-basics.md). Read that first if you are new to components.
3+
> このページは、すでに[コンポーネントの基本](component-basics.md)を読んでいることを前提としています。コンポーネントを初めて使用する場合は、最初にそちらをお読みください。
44
5-
Despite the existence of props and events, sometimes you might still need to directly access a child component in JavaScript. To achieve this you can assign a reference ID to the child component or HTML element using the `ref` attribute. For example:
5+
プロパティやイベントが存在するにもかかわらず、 JavaScript で子コンポーネントに直接アクセスしなければならない場合があります。それを達成するために、`ref` 属性を使うことで子コンポーネントや HTML 要素に参照 ID を割り当てられます。例えば、以下のようになります:
66

77
```html
88
<input ref="input" />
99
```
1010

11-
This may be useful when you want to, for example, programmatically focus this input on component mount:
11+
これは、例えば、コンポーネントのマウント時にプログラムで input をフォーカスさせたい時に便利です:
1212

1313
```js
1414
const app = Vue.createApp({})
@@ -28,7 +28,7 @@ app.component('base-input', {
2828
})
2929
```
3030

31-
Also, you can add another `ref` to the component itself and use it to trigger `focusInput` event from the parent component:
31+
また、別の `ref` をコンポーネント自体に追加し、それを使用して親コンポーネントからの `focusInput` イベントをトリガーできます:
3232

3333
```html
3434
<base-input ref="usernameInput"></base-input>
@@ -39,7 +39,7 @@ this.$refs.usernameInput.focusInput()
3939
```
4040

4141
::: warning
42-
`$refs` are only populated after the component has been rendered. It is only meant as an escape hatch for direct child manipulation - you should avoid accessing `$refs` from within templates or computed properties.
42+
`$refs` は、コンポーネントがレンダリングされた後にのみ生成されます。これは、子要素を直接操作するための脱出ハッチとしてのみ意図されています。テンプレートや `computed` プロパティから `$refs` にアクセスするべきではありません。
4343
:::
4444

45-
**See also**: [Using template refs in Composition API](/guide/composition-api-template-refs.html#template-refs)
45+
**こちらも参照してください**: [コンポジション API でテンプレート参照を使用する](/guide/composition-api-template-refs.html#template-refs)

0 commit comments

Comments
 (0)