fix #505 v-model initial value not piped through write filters

This commit is contained in:
Evan You 2014-10-23 17:25:22 -04:00
parent 21c011e1fe
commit a1c6bcd263
5 changed files with 9 additions and 8 deletions

View File

@ -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
}

View File

@ -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
}
},

View File

@ -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
}
},

View File

@ -124,7 +124,7 @@ function checkInitialValue () {
}
}
if (initValue) {
this.vm.$set(this.expression, initValue)
this._initValue = initValue
}
}

View File

@ -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
}
},