From 16213c0f85aa3ac8317797bf4a05fd12940e16d3 Mon Sep 17 00:00:00 2001 From: zhangwei <1504152376@qq.com> Date: 星期三, 05 三月 2025 17:29:42 +0800 Subject: [PATCH] - --- src/uni_modules/uview-plus/components/u-input/u-input.vue | 16 +++++++++++++++- 1 files changed, 15 insertions(+), 1 deletions(-) diff --git a/src/uni_modules/uview-plus/components/u-input/u-input.vue b/src/uni_modules/uview-plus/components/u-input/u-input.vue index a4e50e9..69d35e2 100644 --- a/src/uni_modules/uview-plus/components/u-input/u-input.vue +++ b/src/uni_modules/uview-plus/components/u-input/u-input.vue @@ -18,6 +18,7 @@ 涓轰簡闃叉type=number鏃讹紝鍙堝瓨鍦╬assword灞炴�э紝type鏃犳晥锛屾鏃堕渶瑕佽缃畃assword涓簎ndefined --> <input + ref="input-native" class="u-input__content__field-wrapper__field" :style="[inputStyle]" :type="type" @@ -44,6 +45,7 @@ @focus="onFocus" @confirm="onConfirm" @keyboardheightchange="onkeyboardheightchange" + @nicknamereview="onnicknamereview" /> </view> <view @@ -223,7 +225,7 @@ }, }, // #ifdef VUE3 - emits: ['update:modelValue', 'focus', 'blur', 'change', 'confirm', 'clear', 'keyboardheightchange'], + emits: ['update:modelValue', 'focus', 'blur', 'change', 'confirm', 'clear', 'keyboardheightchange', 'nicknamereview'], // #endif methods: { // 鍦ㄥ井淇″皬绋嬪簭涓紝涓嶆敮鎸佸皢鍑芥暟褰撳仛props鍙傛暟锛屾晠鍙兘閫氳繃ref褰㈠紡璋冪敤 @@ -258,6 +260,12 @@ this.focused = true; this.$emit("focus"); }, + doFocus() { + this.$refs['input-native'].focus(); + }, + doBlur() { + this.$refs['input-native'].blur(); + }, // 鐐瑰嚮瀹屾垚鎸夐挳鏃惰Е鍙� onConfirm(event) { this.$emit("confirm", this.innerValue); @@ -266,6 +274,9 @@ // 鍏煎鎬э細寰俊灏忕▼搴�2.7.0+銆丄pp 3.1.0+ onkeyboardheightchange(event) { this.$emit("keyboardheightchange", event); + }, + onnicknamereview(event) { + this.$emit("nicknamereview", event); }, // 鍐呭鍙戠敓鍙樺寲锛岃繘琛屽鐞� valueChange(value, isOut = false) { @@ -306,6 +317,9 @@ * 鏃犳硶瑙﹀彂u-form-item鐨勭偣鍑讳簨浠讹紝杩欓噷閫氳繃鎵嬪姩璋冪敤u-form-item鐨勬柟娉曡繘琛岃Е鍙� */ clickHandler() { + if (this.disabled || this.readonly) { + uni.hideKeyboard(); + } // #ifdef APP-NVUE if (os() === "android") { const formItem = $parent.call(this, "u-form-item"); -- Gitblit v1.9.1