Skip to content

Commit

Permalink
fix: 修复支付宝小程序下input类型为数字时双向绑定失效
Browse files Browse the repository at this point in the history
  • Loading branch information
jry committed Aug 1, 2024
1 parent 5f6f3dc commit 88ed7c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/uni_modules/uview-plus/components/u-input/u-input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '
* @property {String} disabledColor 禁用状态时的背景色( 默认 '#f5f7fa' )
* @property {Boolean} clearable 是否显示清除控件 ( 默认 false )
* @property {Boolean} password 是否密码类型 ( 默认 false )
* @property {String | Number} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度 ( 默认 -1 )
* @property {Number} maxlength 最大输入长度,设置为 -1 的时候不限制最大长度 ( 默认 -1 )
* @property {String} placeholder 输入框为空时的占位符
* @property {String} placeholderClass 指定placeholder的样式类,注意页面或组件的style中写了scoped时,需要在类名前写/deep/ ( 默认 'input-placeholder' )
* @property {String | Object} placeholderStyle 指定placeholder的样式,字符串/对象形式,如"color: red;"
Expand All @@ -102,7 +102,7 @@ import { addStyle, addUnit, deepMerge, formValidate, $parent, sleep, os } from '
* @property {Boolean} focus 自动获取焦点,在 H5 平台能否聚焦以及软键盘是否跟随弹出,取决于当前浏览器本身的实现。nvue 页面不支持,需使用组件的 focus()、blur() 方法控制焦点 ( 默认 false )
* @property {Boolean} autoBlur 键盘收起时,是否自动失去焦点,目前仅App3.0.0+有效 ( 默认 false )
* @property {Boolean} disableDefaultPadding 是否去掉 iOS 下的默认内边距,仅微信小程序,且type=textarea时有效 ( 默认 false )
* @property {String | Number} cursor 指定focus时光标的位置( 默认 -1
* @property {String | Number} cursor 指定focus时光标的位置( 默认 140
* @property {String | Number} cursorSpacing 输入框聚焦时底部与键盘的距离 ( 默认 30 )
* @property {String | Number} selectionStart 光标起始位置,自动聚集时有效,需与selection-end搭配使用 ( 默认 -1 )
* @property {String | Number} selectionEnd 光标结束位置,自动聚集时有效,需与selection-start搭配使用 ( 默认 -1 )
Expand Down Expand Up @@ -234,6 +234,7 @@ export default {
onInput(e) {
let { value = "" } = e.detail || {};
// 为了避免props的单向数据流特性,需要先将innerValue值设置为当前值,再在$nextTick中重新赋予设置后的值才有效
// console.log('onInput', value, this.innerValue)
this.innerValue = value;
this.$nextTick(() => {
let formatValue = this.innerFormatter(value);
Expand Down
2 changes: 1 addition & 1 deletion src/uni_modules/uview-plus/libs/config/props/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
disabledColor: '#f5f7fa',
clearable: false,
password: false,
maxlength: -1,
maxlength: 140,
placeholder: null,
placeholderClass: 'input-placeholder',
placeholderStyle: 'color: #c0c4cc',
Expand Down

0 comments on commit 88ed7c2

Please sign in to comment.