Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 29118b4

Browse files
fix __observer__ => __emitter__
1 parent 2abe9ef commit 29118b4

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

‎source/api/instantiation-options.md‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ vm.a // 3
3333

3434
The object must be JSON-compliant (no circular references). You can use it just like an ordinary object, and it will look exactly the same when serialized with `JSON.stringify`. You can also share it between multiple ViewModels.
3535

36-
<p class="tip">Under the hood, vue.js attaches an hidden property `__observer__` and recursively converts the object's non-function properties into getters and setters that trigger events when called. Properties with keys that starts with `$` or `_` are skipped.</p>
36+
<p class="tip">Under the hood, vue.js attaches a hidden property `__emitter__` and recursively converts the object's non-function properties into getters and setters that trigger events when called. Properties with keys that starts with `$` or `_` are skipped.</p>
3737

3838
### methods
3939

@@ -68,7 +68,12 @@ Computed properties to be mixed into the ViewModel. All getters and setters have
6868
var vm = new Vue({
6969
data: { a: 1 },
7070
computed: {
71-
aplus: {
71+
// get only, just need a function
72+
aDouble: function () {
73+
return this.a * 2
74+
},
75+
// both get and set
76+
aPlus: {
7277
$get: function () {
7378
return this.a + 1
7479
},
@@ -78,9 +83,10 @@ var vm = new Vue({
7883
}
7984
}
8085
})
81-
vm.aplus // 2
82-
vm.aplus = 3
86+
vm.aPlus // 2
87+
vm.aPlus = 3
8388
vm.a // 2
89+
vm.aDouble // 4
8490
```
8591

8692
### paramAttributes

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /