Skip to content

Commit b954689

Browse files
committed
fix v-model focus lock (only lock when it is a user input update)
1 parent 9edaa9c commit b954689

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/directives/model/text.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ module.exports = {
5656
? _.toNumber(el.value)
5757
: el.value
5858
self.set(val)
59-
// force update here, because the watcher may not
60-
// run when the value is the same.
59+
// force update on next tick to avoid lock & same value
60+
// also only update when user is not typing
6161
_.nextTick(function () {
62-
if (self._bound) {
62+
if (self._bound && !self.focused) {
6363
self.update(self._watcher.value)
6464
}
6565
})
@@ -115,9 +115,7 @@ module.exports = {
115115
},
116116

117117
update: function (value) {
118-
if (!this.focused) {
119-
this.el.value = _.toString(value)
120-
}
118+
this.el.value = _.toString(value)
121119
},
122120

123121
unbind: function () {

0 commit comments

Comments
 (0)