Skip to content

add missed function () #144

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion source/api/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ Vue.component('prop-validation-demo', {
The following component usage will result in two warnings: type mismatch for "size", and missing required prop "name".

``` html
<prop-validation-demoo size="hello">
<prop-validation-demo size="hello">
</prop-validation-demo>
```

Expand Down
2 changes: 1 addition & 1 deletion source/guide/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ As mentioned above, Vue observes data by converting properties with `Object.defi

These methods can be used to add / delete properties from observed objects while triggering the desired DOM updates. The difference between `$add` and `$set` is that `$add` will return early if the key already exists on the object, so just calling `obj.$add(key)` won’t overwrite the existing value with `undefined`.

A related note is that when you change a data-bound Array directly by setting indices (e.g. `arr[1] = value`), Vue will not be able to pick up the change. Again, you can use augmented methods to notify Vue.js about those changes. Observerd Arrays are augmented with two methods:
A related note is that when you change a data-bound Array directly by setting indices (e.g. `arr[1] = value`), Vue will not be able to pick up the change. Again, you can use augmented methods to notify Vue.js about those changes. Observed Arrays are augmented with two methods:

- `arr.$set(index, value)`
- `arr.$remove(index | value)`
Expand Down
2 changes: 1 addition & 1 deletion source/guide/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ var MyComponent = Vue.extend({
partials: {
// ...
},
effects: {
transitions: {
// ...
}
})
Expand Down
2 changes: 1 addition & 1 deletion source/guide/computed.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ var vm = new Vue({
msg: 'hi'
},
computed: {
example: {
example: function () {
return Date.now() + this.msg
}
}
Expand Down
22 changes: 10 additions & 12 deletions source/guide/custom-filter.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,16 @@ Up till now we have used filters to transform values coming from the model and b

``` js
Vue.filter('currencyDisplay', {
currencyDisplay: {
// model -> view
// formats the value when updating the input element.
read: function(val) {
return '$'+val.toFixed(2)
},
// view -> model
// formats the value when updating the data.
write: function(val, oldVal) {
var number = +val.replace(/[^\d.]/g, '')
return isNaN(number) ? 0 : number
}
// model -> view
// formats the value when updating the input element.
read: function(val) {
return '$'+val.toFixed(2)
},
// view -> model
// formats the value when updating the data.
write: function(val, oldVal) {
var number = +val.replace(/[^\d.]/g, '')
return isNaN(number) ? 0 : number
}
})
```
Expand Down
2 changes: 1 addition & 1 deletion source/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ order: 16

2. You cannot define your own getter/setters on data objects. This isn't much of a problem because data objects are expected to be obtained from plain JSON and Vue.js provides computed properties.

3. Vue.js adds a few extra properties/methods to obsesrved objects: `__ob__`, `$add`, `$set` and `$delete`. These properties are inenumberable so they will not show up in `for ... in ...` loops. However if you overwrite them things will likely break.
3. Vue.js adds a few extra properties/methods to observed objects: `__ob__`, `$add`, `$set` and `$delete`. These properties are inenumberable so they will not show up in `for ... in ...` loops. However if you overwrite them things will likely break.

That's pretty much it. Accessing properties on the object is the same as before, `JSON.stringify` and `for ... in ...` loops will work as normal. 99.9% of the time you don't even need to think about it.

Expand Down