From cf0ba7f621dcfe3b123894f2e9fc0733f891a02c Mon Sep 17 00:00:00 2001 From: "R.D.Sakamoto" Date: Fri, 25 Sep 2020 10:51:53 +0900 Subject: [PATCH] =?UTF-8?q?docs:=20Advanced=20Guides=20>=20Compotion=20API?= =?UTF-8?q?=20>=20Lifecycle=20Hooks=20=E3=81=AE=E7=BF=BB=E8=A8=B3=20#34?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/guide/composition-api-lifecycle-hooks.md | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/guide/composition-api-lifecycle-hooks.md b/src/guide/composition-api-lifecycle-hooks.md index e789456c..097bdff7 100644 --- a/src/guide/composition-api-lifecycle-hooks.md +++ b/src/guide/composition-api-lifecycle-hooks.md @@ -1,15 +1,16 @@ -# Lifecycle Hooks +# ライフサイクルフック -> 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. +> このページは、すでに [コンポジション API の基本](composition-api-introduction.html) と [リアクティブの基礎](reactivity-fundamentals.html) を読んでいることを前提としています。 コンポジション API を初めて使用する場合は、最初にそちらをお読みください。 -You can access a component's lifecycle hook by prefixing the lifecycle hook with "on". +ライフサイクルフックの前に "on" をつけることで、コンポーネントのライフサイクルフックにアクセスすることができます。 -The following table contains how the lifecycle hooks are invoked inside of [setup()](composition-api-setup.html): +[setup()](composition-api-setup.html) 内で、ライフサイクルフックを呼び出す方法は、次の表の通りです: -| Options API | Hook inside inside `setup` | + +| オプション API | `setup` 内のフック | | ----------------- | -------------------------- | -| `beforeCreate` | Not needed\* | -| `created` | Not needed\* | +| `beforeCreate` | 不要\* | +| `created` | 不要\* | | `beforeMount` | `onBeforeMount` | | `mounted` | `onMounted` | | `beforeUpdate` | `onBeforeUpdate` | @@ -21,10 +22,10 @@ The following table contains how the lifecycle hooks are invoked inside of [setu | `renderTriggered` | `onRenderTriggered` | :::tip -Because `setup` is run around the `beforeCreate` and `created` lifecycle hooks, you do not need to explicitly define them. In other words, any code that would be written inside those hooks should be written directly in the `setup` function. +`setup` は `beforeCreate` と `created` のライフサイクルで実行されるため、これらのフックを明示的に定義する必要はありません。言い換えれば、これらのフック内のコードは、 `setup` 内に直接書くべきです。 ::: -These functions accept a callback that will be executed when the hook is called by the component: +これらの関数は、コンポーネントからフックが呼び出された時に実行されるコールバックを、受け入れます: ```js // MyBook.vue