You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> This guide assumes that you have already read the [Composition API Introduction](composition-api-introduction.html)and [Reactivity Fundamentals](reactivity-fundamentals.html). Read that first if you are new to Composition API.
5
+
> このガイドはすでに [コンポジション API 導入](composition-api-introduction.html)を読んでいることを前提に書かれています。もしまだ読んでいないのなら、先に読みましょう。
6
6
7
-
When using the Composition API, the concept of [reactive refs](reactivity-fundamentals.html#creating-standalone-reactive-values-as-refs) and [template refs](component-template-refs.html) are unified. In order to obtain a reference to an in-template element or component instance, we can declare a ref as usual and return it from [setup()](composition-api-setup.html):
7
+
コンポジション API を使うとき、 [リアクティブ参照](reactivity-fundamentals.html#creating-standalone-reactive-values-as-refs) と [テンプレート参照](component-template-refs.html) のコンセプトは同じになります。
@@ -19,7 +20,7 @@ When using the Composition API, the concept of [reactive refs](reactivity-fundam
19
20
constroot=ref(null)
20
21
21
22
onMounted(() => {
22
-
//the DOM element will be assigned to the ref after initial render
23
+
// DOM 要素は初期描画の後に ref に代入されます
23
24
console.log(root.value) // <div>This is a root element</div>
24
25
})
25
26
@@ -31,9 +32,9 @@ When using the Composition API, the concept of [reactive refs](reactivity-fundam
31
32
</script>
32
33
```
33
34
34
-
Here we are exposing `root`on the render context and binding it to the div as its ref via `ref="root"`. In the Virtual DOM patching algorithm, if a VNode's `ref`key corresponds to a ref on the render context, the VNode's corresponding element or component instance will be assigned to the value of that ref. This is performed during the Virtual DOM mount / patch process, so template refs will only get assigned values after the initial render.
35
+
描画コンテキストに `root`変数を渡していて、`ref="root"` 経由で div 要素と束縛します。 仮想 DOM のパッチアルゴリズムの中で、 もし VNode の `ref`キーは描画コンテキストの ref に対応すると、VNode の対応する要素またはコンポーネントインスタンスに ref の値が割り当てられます。これは仮想 DOM のマウント/パッチ処理中に実行されるので、テンプレート refs では初期描画に値だけを取得できます。
35
36
36
-
Refs used as templates refs behave just like any other refs: they are reactive and can be passed into (or returned from) composition functions.
0 commit comments