Skip to content

Commit 13fe724

Browse files
committed
fix filter application with scope (fix #1234)
1 parent 3cd1b53 commit 13fe724

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/watcher.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,7 @@ Watcher.prototype.addDep = function (dep) {
8383

8484
Watcher.prototype.get = function () {
8585
this.beforeGet()
86-
var vm = this.vm
87-
var scope = this.scope || vm
86+
var scope = this.scope || this.vm
8887
var value
8988
try {
9089
value = this.getter.call(scope, scope)
@@ -112,7 +111,7 @@ Watcher.prototype.get = function () {
112111
value = this.preProcess(value)
113112
}
114113
if (this.filters) {
115-
value = vm._applyFilters(value, null, this.filters, false)
114+
value = scope._applyFilters(value, null, this.filters, false)
116115
}
117116
this.afterGet()
118117
return value
@@ -125,10 +124,9 @@ Watcher.prototype.get = function () {
125124
*/
126125

127126
Watcher.prototype.set = function (value) {
128-
var vm = this.vm
129-
var scope = this.scope || vm
127+
var scope = this.scope || this.vm
130128
if (this.filters) {
131-
value = vm._applyFilters(
129+
value = scope._applyFilters(
132130
value, this.value, this.filters, true)
133131
}
134132
try {

0 commit comments

Comments
 (0)