From f76b1d5deb09f89bf204fcf88f50d466d64b570b Mon Sep 17 00:00:00 2001 From: James Fuller Date: Mon, 20 Feb 2017 13:38:32 -0500 Subject: [PATCH 1/2] Update two-way computed property form example Added a template example to demonstrate two-way computed bound on the input using v-model. --- docs/en/forms.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/en/forms.md b/docs/en/forms.md index 219c6377d..3158c9cb2 100644 --- a/docs/en/forms.md +++ b/docs/en/forms.md @@ -42,6 +42,9 @@ mutations: { Admittedly, the above is quite a bit more verbose than `v-model` + local state, and we lose some of the useful features from `v-model` as well. An alternative approach is using a two-way computed property with a setter: +``` html + +``` ``` js // ... computed: { From 420b95433002014dcbfca2460db410ff13687dbb Mon Sep 17 00:00:00 2001 From: ktsn Date: Wed, 22 Feb 2017 09:16:48 +0900 Subject: [PATCH 2/2] update for all lang --- docs/fr/forms.md | 3 +++ docs/ja/forms.md | 3 +++ docs/kr/forms.md | 3 +++ docs/ru/forms.md | 4 +++- docs/zh-cn/forms.md | 4 +++- 5 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/fr/forms.md b/docs/fr/forms.md index fb5b3cb4f..94da84383 100644 --- a/docs/fr/forms.md +++ b/docs/fr/forms.md @@ -42,6 +42,9 @@ mutations: { Admettons tout de même que l'exemple ci-dessus est plus verbeux que le `v-model` couplé au state local, et on perd quelques fonctionnalités pratiques de `v-model` au passage. Une approche alternative consiste à utiliser une computed property bi-directionnelle avec un setter : +``` html + +``` ``` js // ... computed: { diff --git a/docs/ja/forms.md b/docs/ja/forms.md index 828c6f34f..e6839f472 100644 --- a/docs/ja/forms.md +++ b/docs/ja/forms.md @@ -42,6 +42,9 @@ mutations: { 確かに、上記の例は単純な `v-model` と ローカルステートよりもかなり冗長で、`v-model` のいくつかの有用な機能が使えません。代わりに、セッターで双方向算出プロパティを使うアプローチがあります。 +``` html + +``` ``` js computed: { message: { diff --git a/docs/kr/forms.md b/docs/kr/forms.md index e0d376b36..03e7320c5 100644 --- a/docs/kr/forms.md +++ b/docs/kr/forms.md @@ -42,6 +42,9 @@ mutations: { 틀림없이, 위의 내용은 `v-model` + 지역 상태보다 좀더 장황 해졌고, `v-model`의 유용한 기능 중 일부를 잃어 버렸습니다. 다른 방법은 setter를 사용하여 양방향 계산된 속성을 사용하는 것입니다. +``` html + +``` ``` js // ... computed: { diff --git a/docs/ru/forms.md b/docs/ru/forms.md index a88779c79..b9907e346 100644 --- a/docs/ru/forms.md +++ b/docs/ru/forms.md @@ -42,6 +42,9 @@ mutations: { Заметно, что получившаяся выше запись — куда многословнее, чем используемая в связке `v-model` с локальным состоянием, да и некоторые полезные возможности `v-model` мы таким образом упускаем. В качестве альтернативы можно предложить использование двунаправленного вычисляемого свойства с сеттером: +``` html + +``` ``` js // ... computed: { @@ -55,4 +58,3 @@ computed: { } } ``` - diff --git a/docs/zh-cn/forms.md b/docs/zh-cn/forms.md index 26f3e6030..6b66b904f 100644 --- a/docs/zh-cn/forms.md +++ b/docs/zh-cn/forms.md @@ -42,6 +42,9 @@ mutations: { 必须承认,这样做比简单地使用“`v-model` + 局部状态”要啰嗦得多,并且也损失了一些 `v-model` 中很有用的特性。另一个方法是使用带有 setter 的双向绑定计算属性: +``` html + +``` ``` js // ... computed: { @@ -55,4 +58,3 @@ computed: { } } ``` -