diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index 261f32d7cd02f672a31e17d19e023a6154c39b70..097edda4524d23b5c9a320711aba9bb3c9859644 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -140,7 +140,7 @@ 设置输入框聚焦时光标的位置(点这里) - + @@ -150,7 +150,7 @@ + :selection-end="selectionEnd" :focus="selectionInputFocus" @blur="onSelectionBlurChange" /> @@ -160,7 +160,7 @@ - + @@ -297,10 +297,13 @@ showClearIcon: false, inputClearValue: '', showPassword: true, - cursor: -1, + cursor: -1, + cursorInputFocus: false, cursor_color: "#3393E2", + cursorColorInputFocus: false, selectionStart: -1, selectionEnd: -1, + selectionInputFocus: false, inputEventDetail: '', focusAndBlurEventDetail: '', confirmEventDetail: '', @@ -331,19 +334,23 @@ this.onMaxLengthInputValue = event.detail.value }, setCursor: function (cursor : number) { - (this.$refs['input'] as UniInputElement).focus(); + // (this.$refs['input'] as UniInputElement).focus(); + this.cursorInputFocus = true this.cursor = cursor; }, onCursorBlurChange() { - this.cursor = 0 + this.cursor = 0 + this.cursorInputFocus = false }, setSelection: function (selectionStart : number, selectionEnd : number) { - (this.$refs['input2'] as UniInputElement).focus(); + // (this.$refs['input2'] as UniInputElement).focus(); + this.selectionInputFocus = true this.selectionStart = selectionStart; this.selectionEnd = selectionEnd; }, onSelectionBlurChange() { - this.selectionEnd = 0; + this.selectionEnd = 0; + this.selectionInputFocus = false }, clearInput: function (event : UniInputEvent) { this.inputClearValue = event.detail.value @@ -391,8 +398,12 @@ } else { this.cursor_color = "#3393E2" } - const input = uni.getElementById("uni-input-cursor-color") - input?.focus() + // const input = uni.getElementById("uni-input-cursor-color") + // input?.focus() + this.cursorColorInputFocus = true + }, + cursorColorInputBlur(event : UniInputBlurEvent) { + this.cursorColorInputFocus = false }, changeHoldKeyboard(event : UniSwitchChangeEvent) { const checked = event.detail.value;