Skip to content

Extend and clarify the explanation #293

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 3 commits into from
Aug 3, 2017
Merged
Changes from all commits
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
8 changes: 5 additions & 3 deletions src/v2/guide/syntax.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: テンプレート構文
updated: 2017-06-29
updated: 2017-08-03
type: guide
order: 4
---
Expand Down Expand Up @@ -130,7 +130,7 @@ Vue.js では、一般的なテキストフォーマットを適用するため

<p class="tip">Vue 2.x フィルタは、mustache バインディングと `v-bind` 式 (2.1.0 以降のサポート)でだけ使用できます。同じ振る舞いをディレクティブのバインディング内部で実現するには、代わりに[算出プロパティ](computed.html)を使用すべきです。</p>

フィルタ関数は常に式の値を第一引数として受け取ります
フィルタ関数は常に式の値(前のチェーンの結果)を第一引数として受け取ります。この例では、 `capitalize` フィルタ関数は引数として `message` の値を受け取ります

``` js
new Vue({
Expand All @@ -151,13 +151,15 @@ new Vue({
{{ message | filterA | filterB }}
```

この場合、単一の引数で定義された `filterA` は `message` の値を受け取り、`filterB`の単一引数に `filterA` の結果を渡して `filterB` 関数が呼び出されます。

フィルタは JavaScript 関数なので、引数を取ります:

``` html
{{ message | filterA('arg1', arg2) }}
```

ここでプレーン文字列 `'arg1'` は、第2引数としてフィルタに渡されます。そして、式 `arg2` の値は評価され、第3引数としてフィルタに渡されます。
ここで `filterA` は3つの引数をとる関数として定義されています。`message` の値は最初の引数に渡されます。プレーン文字列 `'arg1'` は、第2引数として `filterA` に渡されます。そして、式 `arg2` の値が評価され、第3引数としてフィルタに渡されます。

## 省略記法

Expand Down