From 28c4dbb55b710b736ae046fccd5e6490b45b2883 Mon Sep 17 00:00:00 2001 From: oohira Date: Mon, 18 Feb 2019 23:59:25 +0900 Subject: [PATCH 1/2] Translate v2.6 updates for api/index.md --- src/v2/api/index.md | 110 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 55 deletions(-) diff --git a/src/v2/api/index.md b/src/v2/api/index.md index e5064ed60..0d1eace86 100644 --- a/src/v2/api/index.md +++ b/src/v2/api/index.md @@ -1,7 +1,7 @@ --- title: API type: api -updated: 2019-02-11 +updated: 2019-02-18 --- ## グローバル設定 @@ -85,7 +85,7 @@ updated: 2019-02-11 > 2.4.0 以降では、このフックは Vue のカスタムイベントハンドラ内部で投げられたエラーもキャプチャします。 - > In 2.6.0+, this hook also captures errors thrown inside `v-on` DOM listeners. In addition, if any of the covered hooks or handlers returns a Promise chain (e.g. async functions), the error from that Promise chain will also be handled. + > 2.6.0 以降では、このフックは `v-on` DOM リスナ内で投げられたエラーもキャプチャします。加えて、フックやハンドラが Promise チェーン (例えば、async 関数) を返す場合、その Promise チェーンからのエラーもハンドリングされます。 > エラー追跡サービスの [Sentry](https://sentry.io/for/vue/) と [Bugsnag](https://docs.bugsnag.com/platforms/browsers/vue/) はこのオプションを使用して公式の統合を提供しています。 @@ -408,16 +408,16 @@ updated: 2019-02-11 ### Vue.observable( object ) -> New in 2.6.0+ +> 2.6.0 から新規 -- **Arguments:** +- **引数:** - `{Object} object` -- **Usage:** +- **使用方法:** - Make an object reactive. Internally, Vue uses this on the object returned by the `data` function. + オブジェクトをリアクティブにします。内部的には、Vue は `data` 関数から返されたオブジェクトに対してこれを使っています。 - The returned object can be used directly inside [render functions](../guide/render-function.html) and [computed properties](../guide/computed.html), and will trigger appropriate updates when mutated. It can also be used as a minimal, cross-component state store for simple scenarios: + 戻り値のオブジェクトは、[描画関数](../guide/render-function.html) や [算出プロパティ](../guide/computed.html) の中で直接使え、値が変更されたときには適切な更新をトリガーします。単純なシナリオでは、コンポーネントをまたぐ最小の state ストアとして使用することもできます: ``` js const state = Vue.observable({ count: 0 }) @@ -431,9 +431,9 @@ updated: 2019-02-11 } ``` -

In Vue 2.x, `Vue.observable` directly mutates the object passed to it, so that it is equivalent to the object returned, as [demonstrated here](../guide/instance.html#Data-and-Methods). In Vue 3.x, a reactive proxy will be returned instead, leaving the original object non-reactive if mutated directly. Therefore, for future compatibility, we recommend always working with the object returned by `Vue.observable`, rather than the object originally passed to it.

+

Vue 2.x では、`Vue.observable` は渡されたオブジェクトを直接操作するため、[ここでデモされる](../guide/instance.html#データとメソッド) ように戻り値のオブジェクトと等しくなります。Vue 3.x では、代わりにリアクティブプロキシを返し、元のオブジェクトを直接変更してもリアクティブにならないようにします。そのため、将来の互換性を考えると、`Vue.observable` に渡したオブジェクトではなく、返されたオブジェクトを使うことを推奨します。

-- **See also:** [Reactivity in Depth](../guide/reactivity.html) +- **参照:** [リアクティブの探求](../guide/reactivity.html) ### Vue.version @@ -1378,7 +1378,7 @@ updated: 2019-02-11 - **デフォルト:** - プログラム的に[スロットにより配信された](/guide/components.html#スロットによるコンテンツ配信)コンテンツにアクセスするために使用されます。各[名前付きスロット](/guide/components.html#名前付きスロット) は自身に対応するプロパティを持ちます (例: `slot="foo"` のコンテンツは `vm.$slots.foo` で見つかります)。`default` プロパティは名前付きスロットに含まれない任意のノードを含みます。 + プログラム的に[スロットにより配信された](/guide/components.html#スロットによるコンテンツ配信)コンテンツにアクセスするために使用されます。各[名前付きスロット](../guide/components-slots.html#名前付きスロット) は自身に対応するプロパティを持ちます (例: `slot="foo"` のコンテンツは `vm.$slots.foo` で見つかります)。`default` プロパティは名前付きスロットに含まれない任意のノードを含みます。 `vm.$slots` のアクセスは、[描画関数](/guide/render-function.html) によるコンポーネントを書くときに最も便利です。 @@ -1430,19 +1430,19 @@ updated: 2019-02-11 - **詳細:** - [スコープ付きスロット (scoped slot)](../guide/components.html#スコープ付きスロット)にプログラムでアクセスするために使用されます。`default` を含む各スロットに対して、オブジェクトには VNode を返す対応する関数が含まれています。 + [スコープ付きスロット](../guide/components-slots.html#スコープ付きスロット) にプログラムでアクセスするために使用されます。`default` を含む各スロットに対して、オブジェクトには VNode を返す対応する関数が含まれています。 `vm.$scopedSlots` にアクセスする際に、[描画関数](../guide/render-function.html) でコンポーネントを書くときに最も便利です。 - **Note:** since 2.6.0+, there are two notable changes to this property: + **注意:** 2.6.0 以降では、このプロパティに特筆すべき変更が 2 つあります: - 1. Scoped slot functions are now guaranteed to return an array of VNodes, unless the return value is invalid, in which case the function will return `undefined`. + 1. スコープ付きスロット関数は、戻り値が不正でない限り (この場合は `undefined` を返す) VNode の配列を返すことが保証されるようになりました。 - 2. All `$slots` are now also exposed on `$scopedSlots` as functions. If you work with render functions, it is now recommended to always access slots via `$scopedSlots`, whether they currently use a scope or not. This will not only make future refactors to add a scope simpler, but also ease your eventual migration to Vue 3, where all slots will be functions. + 2. すべての `$slots` は `$scopedSlots` にも関数として公開されるようになりました。描画関数を使う場合、今後はスコープ付きを使うかどうかに関係なく、常に `$scopedSlots` 経由でスロットにアクセスすることを推奨します。これは、将来スコープを追加するリファクタリングをシンプルにするだけでなく、すべてのスロットが関数になる Vue 3 への移行を簡単にします。 -- **See also:** - - [`` コンポーネント](#slot-1) - - [スコープ付きスロット](../guide/components.html#スコープ付きスロット) +- **参照:** + - [`` コンポーネント](#slot) + - [スコープ付きスロット](../guide/components-slots.html#スコープ付きスロット) - [描画関数 - スロット](../guide/render-function.html#スロット) ### vm.$refs @@ -1987,7 +1987,7 @@ updated: 2019-02-11 ### v-for -- **要求事項:** `Array | Object | number | string | Iterable (since 2.6)` +- **要求事項:** `Array | Object | number | string | Iterable (2.6 以降)` - **使用方法:** @@ -2015,7 +2015,7 @@ updated: 2019-02-11 ``` - In 2.6+, `v-for` can also work on values that implement the [Iterable Protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol), including native `Map` and `Set`. However, it should be noted that Vue 2.x currently does not support reactivity on `Map` and `Set` values, so cannot automatically detect changes. + 2.6 以降では、`v-for` はネイティブの `Map` や `Set`を含む、[Iterable プロトコル](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) を実装した値でも動作できるようになりました。ただし、Vue 2.x は今のところ `Map` 値や `Set` 値をリアクティブにはできず、変更を自動的に検知できない点は注意しておく必要があります。

`v-if` といっしょに使用されるとき、`v-for` は `v-if` より優先度が高くなります。詳細についてはリストレンダリングのガイドを参照してください。

@@ -2062,7 +2062,7 @@ updated: 2019-02-11 - + @@ -2071,7 +2071,7 @@ updated: 2019-02-11 - + @@ -2145,13 +2145,13 @@ updated: 2019-02-11 - + - + @@ -2220,24 +2220,24 @@ updated: 2019-02-11 ### v-slot -- **Shorthand:** `#` +- **省略記法:** `#` -- **Expects:** JavaScript expression that is valid in a function argument position (supports destructuring in [supported environments](../guide/components-slots.html#Slot-Props-Destructuring)). Optional - only needed if expecting props to be passed to the slot. +- **要求事項:** 関数定義の引数部分で有効な JavaScript 式 ([サポートされている環境](../guide/components-slots.html#スロットプロパティの分割代入) では分割代入も使用可能)。省略可 - プロパティがスロットに渡される場合のみ必要。 -- **Argument:** slot name (optional, defaults to `default`) +- **引数:** スロット名 (省略可。デフォルト値 `default`) -- **Limited to:** +- **適用対象制限:** - `