Skip to content

Commit 50a79e4

Browse files
committed
revert v-for alias two-way binding warning (fix #1778)
1 parent 0a76d21 commit 50a79e4

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed

src/watcher.js

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,17 @@ Watcher.prototype.set = function (value) {
145145
}
146146
// two-way sync for v-for alias
147147
var forContext = scope.$forContext
148-
if (process.env.NODE_ENV !== 'production') {
149-
if (
150-
forContext &&
151-
forContext.filters &&
152-
(new RegExp(forContext.alias + '\\b')).test(this.expression)
153-
) {
154-
_.warn(
148+
if (forContext && forContext.alias === this.expression) {
149+
if (forContext.filters) {
150+
process.env.NODE_ENV !== 'production' && _.warn(
155151
'It seems you are using two-way binding on ' +
156152
'a v-for alias (' + this.expression + '), and the ' +
157153
'v-for has filters. This will not work properly. ' +
158154
'Either remove the filters or use an array of ' +
159155
'objects and bind to object properties instead.'
160156
)
157+
return
161158
}
162-
}
163-
if (
164-
forContext &&
165-
forContext.alias === this.expression &&
166-
!forContext.filters
167-
) {
168159
if (scope.$key) { // original is an object
169160
forContext.rawValue[scope.$key] = value
170161
} else {

0 commit comments

Comments
 (0)