| | |
| | | 为了防止type=number时,又存在password属性,type无效,此时需要设置password为undefined |
| | | --> |
| | | <input |
| | | ref="input-native" |
| | | class="u-input__content__field-wrapper__field" |
| | | :style="[inputStyle]" |
| | | :type="type" |
| | |
| | | @focus="onFocus" |
| | | @confirm="onConfirm" |
| | | @keyboardheightchange="onkeyboardheightchange" |
| | | @nicknamereview="onnicknamereview" |
| | | /> |
| | | </view> |
| | | <view |
| | |
| | | }, |
| | | }, |
| | | // #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形式调用 |
| | |
| | | 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); |
| | |
| | | // 兼容性:微信小程序2.7.0+、App 3.1.0+ |
| | | onkeyboardheightchange(event) { |
| | | this.$emit("keyboardheightchange", event); |
| | | }, |
| | | onnicknamereview(event) { |
| | | this.$emit("nicknamereview", event); |
| | | }, |
| | | // 内容发生变化,进行处理 |
| | | valueChange(value, isOut = false) { |
| | |
| | | * 无法触发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"); |