mirror of https://github.com/vuejs/vue.git
				
				
				
			fix #505 v-model initial value not piped through write filters
This commit is contained in:
		
							parent
							
								
									21c011e1fe
								
							
						
					
					
						commit
						a1c6bcd263
					
				| 
						 | 
					@ -91,7 +91,11 @@ p._bind = function (def) {
 | 
				
			||||||
      watcher.addCb(update)
 | 
					      watcher.addCb(update)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    this._watcher = watcher
 | 
					    this._watcher = watcher
 | 
				
			||||||
    this.update(watcher.value)
 | 
					    if (this._initValue != null) {
 | 
				
			||||||
 | 
					      watcher.set(this._initValue)
 | 
				
			||||||
 | 
					    } else {
 | 
				
			||||||
 | 
					      this.update(watcher.value)
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  this._bound = true
 | 
					  this._bound = true
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,7 @@ module.exports = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    _.on(el, 'change', this.listener)
 | 
					    _.on(el, 'change', this.listener)
 | 
				
			||||||
    if (el.checked) {
 | 
					    if (el.checked) {
 | 
				
			||||||
      // watcher is not set up yet
 | 
					      this._initValue = el.checked
 | 
				
			||||||
      this.vm.$set(this.expression, el.checked)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,8 +10,7 @@ module.exports = {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    _.on(el, 'change', this.listener)
 | 
					    _.on(el, 'change', this.listener)
 | 
				
			||||||
    if (el.checked) {
 | 
					    if (el.checked) {
 | 
				
			||||||
      // watcher is not set up yet
 | 
					      this._initValue = el.value
 | 
				
			||||||
      this.vm.$set(this.expression, el.value)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -124,7 +124,7 @@ function checkInitialValue () {
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
  if (initValue) {
 | 
					  if (initValue) {
 | 
				
			||||||
    this.vm.$set(this.expression, initValue)
 | 
					    this._initValue = initValue
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -99,8 +99,7 @@ module.exports = {
 | 
				
			||||||
      el.hasAttribute('value') ||
 | 
					      el.hasAttribute('value') ||
 | 
				
			||||||
      (el.tagName === 'TEXTAREA' && el.value.trim())
 | 
					      (el.tagName === 'TEXTAREA' && el.value.trim())
 | 
				
			||||||
    ) {
 | 
					    ) {
 | 
				
			||||||
      // watcher is not set up yet
 | 
					      this._initValue = el.value
 | 
				
			||||||
      this.vm.$set(this.expression, el.value)
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue