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)
|
||||
}
|
||||
this._watcher = watcher
|
||||
this.update(watcher.value)
|
||||
if (this._initValue != null) {
|
||||
watcher.set(this._initValue)
|
||||
} else {
|
||||
this.update(watcher.value)
|
||||
}
|
||||
}
|
||||
this._bound = true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ module.exports = {
|
|||
}
|
||||
_.on(el, 'change', this.listener)
|
||||
if (el.checked) {
|
||||
// watcher is not set up yet
|
||||
this.vm.$set(this.expression, el.checked)
|
||||
this._initValue = el.checked
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -10,8 +10,7 @@ module.exports = {
|
|||
}
|
||||
_.on(el, 'change', this.listener)
|
||||
if (el.checked) {
|
||||
// watcher is not set up yet
|
||||
this.vm.$set(this.expression, el.value)
|
||||
this._initValue = el.value
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ function checkInitialValue () {
|
|||
}
|
||||
}
|
||||
if (initValue) {
|
||||
this.vm.$set(this.expression, initValue)
|
||||
this._initValue = initValue
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -99,8 +99,7 @@ module.exports = {
|
|||
el.hasAttribute('value') ||
|
||||
(el.tagName === 'TEXTAREA' && el.value.trim())
|
||||
) {
|
||||
// watcher is not set up yet
|
||||
this.vm.$set(this.expression, el.value)
|
||||
this._initValue = el.value
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue