From 7042f0d6d5d69a44f1d8e12eb2ff688b7f990a2e Mon Sep 17 00:00:00 2001 From: Naoki Endoh Date: Tue, 8 Jun 2021 21:10:31 +0900 Subject: [PATCH] The description of this in setup is inconsistent with the source code https://github.com/vuejs/docs-next/commit/42bb2a2abf2a93f30094cf645e433b5ffca2744a --- src/guide/composition-api-introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/guide/composition-api-introduction.md b/src/guide/composition-api-introduction.md index 2fff29a6..c06ef64c 100644 --- a/src/guide/composition-api-introduction.md +++ b/src/guide/composition-api-introduction.md @@ -76,7 +76,7 @@ export default { 新しい `setup` コンポーネントオプションは、コンポーネントが作成される前に `props` が解決されると実行され、 Composition API のエントリポイントとして機能します。 ::: warning -`setup` が実行されたときは、まだコンポーネントのインスタンスが作られないため、`setup` オプションの中では `this` を使用できません。これは `props` を除いて、コンポーネント内で宣言されているあらゆるプロパティ (**ローカルの state** や **computed プロパティ**、**methods**) にアクセスできないことを意味します。 +コンポーネントのインスタンスを参照しないため、`setup` の中で `this` を使うのは避けるべきです。`setup` は `data` プロパティ、`computed` プロパティ、`methods` が解決される前に呼び出されるため、`setup` の中では利用できません。 ::: `setup` オプションは `props` と[後で](composition-api-setup.html#引数)紹介する `context` を受け付ける関数であるべきです。さらに、`setup` から返される全てのものは、コンポーネントの残りの要素 (computed プロパティ、methods、ライフサイクルフックなど) およびコンポーネントの template に公開されます。