Skip to content

Commit 3ce7605

Browse files
committed
fix(QInput): issue using Chinese on safari/ios quasarframework#9179
1 parent bc012f2 commit 3ce7605

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

ui/src/components/input/QInput.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,13 +206,15 @@ export default Vue.extend({
206206
this.__emitValue(val)
207207

208208
if (['text', 'search', 'url', 'tel', 'password'].includes(this.type) && e.target === document.activeElement) {
209-
const index = e.target.selectionEnd
210-
211-
index !== void 0 && this.$nextTick(() => {
212-
if (e.target === document.activeElement && val.indexOf(e.target.value) === 0) {
213-
e.target.setSelectionRange(index, index)
214-
}
215-
})
209+
const { selectionStart, selectionEnd } = e.target
210+
211+
if (selectionStart !== void 0 && selectionEnd !== void 0) {
212+
this.$nextTick(() => {
213+
if (e.target === document.activeElement && val.indexOf(e.target.value) === 0) {
214+
e.target.setSelectionRange(selectionStart, selectionEnd)
215+
}
216+
})
217+
}
216218
}
217219
}
218220

0 commit comments

Comments
 (0)