File tree 1 file changed +17
-8
lines changed
Filter options
1 file changed +17
-8
lines changed
Original file line number Diff line number Diff line change @@ -145,17 +145,26 @@ Watcher.prototype.set = function (value) {
145
145
}
146
146
// two-way sync for v-for alias
147
147
var forContext = scope . $forContext
148
- if ( forContext && forContext . alias === this . expression ) {
149
- if ( forContext . filters ) {
150
- process . env . NODE_ENV !== 'production' && _ . warn (
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 (
151
155
'It seems you are using two-way binding on ' +
152
- 'a v-for alias, and the v-for has filters. ' +
153
- 'This will not work properly. Either remove the ' +
154
- 'filters or use an array of objects and bind to ' +
155
- 'object properties instead.'
156
+ 'a v-for alias (' + this . expression + '), and the ' +
157
+ 'v-for has filters. This will not work properly. ' +
158
+ 'Either remove the filters or use an array of ' +
159
+ 'objects and bind to object properties instead.'
156
160
)
157
- return
158
161
}
162
+ }
163
+ if (
164
+ forContext &&
165
+ forContext . alias === this . expression &&
166
+ ! forContext . filters
167
+ ) {
159
168
if ( scope . $key ) { // original is an object
160
169
forContext . rawValue [ scope . $key ] = value
161
170
} else {
You can’t perform that action at this time.
0 commit comments