8000 v2.2アップデートにおけるsrc/v2/api/index.mdの変更の翻訳 by potato4d · Pull Request #230 · vuejs/jp.vuejs.org · GitHub
[go: up one dir, main page]

Skip to content

v2.2アップデートにおけるsrc/v2/api/index.mdの変更の翻訳 #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 1, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
renderErrorの翻訳
  • Loading branch information
potato4d committed Feb 26, 2017
commit 60d6a62061268347c707e8cba32fa9e3af6dc365
30 changes: 29 additions & 1 deletion src/v2/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ type: api

### render

- **型:** `Function`
- **型:** `(createElement: () => VNode) => VNode`

- **詳細:**

Expand All @@ -643,6 +643,34 @@ type: api
- **参照:**
- [描画関数](../guide/render-function.html)

### renderError

> 2.2.0 からの進行

- **型:** `(createElement: () => VNode, error: Error) => VNode`

- **詳細:**

**development モードでのみ動作します。**

デフォルトの `render` 関数にてエラーが発生した際に、代替となる描画結果を提供します。この際、エラー内容は `renderError` へ、第二引数として渡されます。この機能は、ホットリロードなどと併用する場合に重宝します。

- **例:**

``` js
new Vue({
render (h) {
throw new Error('oops')
},
renderError (h, err) {
return h('pre', { style: { color: 'red' }}, err.stack)
}
}).$mount('#app')
```

- **参照:**
- [描画関数](../guide/render-function)

## オプション / ライフサイクルフック

全てのライフサイクルフックは、データ、算出プロパティ、およびメソッドにアクセスできるようにするために、自動的にインスタンスに束縛する `this` コンテキストを持っています。これは、__ライフサイクルメソッド(例 `created: () => this.fetchTodos()`) を定義するためにアロー関数を使用すべきではないこと__を意味します。アロー関数は、`this` が期待する Vue インスタンスではなく、`this.fetchTodos` が undefined になるため、親コンテキストに束縛できないことが理由です。
Expand Down
0