🌐 AI搜索 & 代理 主页
Skip to content

Commit 3c543b0

Browse files
committed
Update form-text.js
1 parent c94380a commit 3c543b0

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/mixins/form-text.js

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -161,23 +161,24 @@ export default {
161161
if (lazy && !force) {
162162
return
163163
}
164+
// Make sure to always clear the debounce when `updateValue()`
165+
// is called, even when the v-model hasn't changed
166+
this.clearDebounce()
164167
value = this.modifyValue(value)
165-
const debounce = this.computedDebounce
166-
if (debounce > 0 && !lazy && !force) {
168+
if (value !== this.vModelValue) {
169+
const doUpdate = () => {
170+
this.vModelValue = value
171+
this.$emit('update', value)
172+
}
173+
const debounce = this.computedDebounce
167174
// Only debounce the value update when a value greater than `0`
168175
// is set and we are not in lazy mode or this is a forced update
169-
this.clearDebounce()
170-
const doUpdate = () => {
171-
if (value !== this.vModelValue) {
172-
this.vModelValue = value
173-
this.$emit('update', value)
174-
}
176+
if (debounce > 0 && !lazy && !force) {
177+
this.$_inputDebounceTimer = setTimeout(doUpdate, debounce)
178+
} else {
179+
// Immediately update the v-model
180+
doUpdate()
175181
}
176-
this.$_inputDebounceTimer = setTimeout(doUpdate, debounce)
177-
} else if (value !== this.vModelValue) {
178-
// Immediately update the v-model
179-
this.vModelValue = value
180-
this.$emit('update', value)
181182
} else if (this.hasFormatter) {
182183
// When the `vModelValue` hasn't changed but the actual input value
183184
// is out of sync, make sure to change it to the given one

0 commit comments

Comments
 (0)