-
zhangwei
2025-03-05 16213c0f85aa3ac8317797bf4a05fd12940e16d3
src/uni_modules/uview-plus/components/u-input/u-input.vue
@@ -18,6 +18,7 @@
               为了防止type=number时,又存在password属性,type无效,此时需要设置password为undefined
             -->
               <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+、App 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");