|
|
@@ -145,17 +145,26 @@ Watcher.prototype.set = function (value) {
|
|
|
}
|
|
|
// two-way sync for v-for alias
|
|
|
var forContext = scope.$forContext
|
|
|
- if (forContext && forContext.alias === this.expression) {
|
|
|
- if (forContext.filters) {
|
|
|
- process.env.NODE_ENV !== 'production' && _.warn(
|
|
|
+ if (process.env.NODE_ENV !== 'production') {
|
|
|
+ if (
|
|
|
+ forContext &&
|
|
|
+ forContext.filters &&
|
|
|
+ (new RegExp(forContext.alias + '\\b')).test(this.expression)
|
|
|
+ ) {
|
|
|
+ _.warn(
|
|
|
'It seems you are using two-way binding on ' +
|
|
|
- 'a v-for alias, and the v-for has filters. ' +
|
|
|
- 'This will not work properly. Either remove the ' +
|
|
|
- 'filters or use an array of objects and bind to ' +
|
|
|
- 'object properties instead.'
|
|
|
+ 'a v-for alias (' + this.expression + '), and the ' +
|
|
|
+ 'v-for has filters. This will not work properly. ' +
|
|
|
+ 'Either remove the filters or use an array of ' +
|
|
|
+ 'objects and bind to object properties instead.'
|
|
|
)
|
|
|
- return
|
|
|
}
|
|
|
+ }
|
|
|
+ if (
|
|
|
+ forContext &&
|
|
|
+ forContext.alias === this.expression &&
|
|
|
+ !forContext.filters
|
|
|
+ ) {
|
|
|
if (scope.$key) { // original is an object
|
|
|
forContext.rawValue[scope.$key] = value
|
|
|
} else {
|