Skip to content

Commit 2dc2cc1

Browse files
committed
fix custom filter code example (close #131)
1 parent ed69b03 commit 2dc2cc1

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

source/guide/custom-filter.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,16 @@ Up till now we have used filters to transform values coming from the model and b
3737

3838
``` js
3939
Vue.filter('currencyDisplay', {
40-
currencyDisplay: {
41-
// model -> view
42-
// formats the value when updating the input element.
43-
read: function(val) {
44-
return '$'+val.toFixed(2)
45-
},
46-
// view -> model
47-
// formats the value when updating the data.
48-
write: function(val, oldVal) {
49-
var number = +val.replace(/[^\d.]/g, '')
50-
return isNaN(number) ? 0 : number
51-
}
40+
// model -> view
41+
// formats the value when updating the input element.
42+
read: function(val) {
43+
return '$'+val.toFixed(2)
44+
},
45+
// view -> model
46+
// formats the value when updating the data.
47+
write: function(val, oldVal) {
48+
var number = +val.replace(/[^\d.]/g, '')
49+
return isNaN(number) ? 0 : number
5250
}
5351
})
5452
```

0 commit comments

Comments
 (0)