7***@qq.com
7***@qq.com
  • 发布:2024-01-20 15:45
  • 更新:2024-08-09 11:01
  • 阅读:276

#插件讨论# 【 uni-number-box 数字输入框 - DCloud前端团队 】软键盘操作问题

分类:uni-app

插件用于微信小程序时,数入数字,不收回软键盘,组件数据没有更新,直接点击其他按钮时获取不到数字框的值,用户体验不太好,这个有办法优化么?

2024-01-20 15:45 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com - 精通uniapp,vue,react,node,go

修改uni-number-box源码,增加@input="_onInput"

<input :disabled="disabled" @input="_onInput" @focus="_onFocus" @blur="_onBlur" class="uni-numbox__value"
type="number" v-model="inputValue" :style="{background, color}" />

在methods定义这个方法,
_onInput(event) {
const value = event.target.value;
this.inputValue = value;
this.$emit("input", +this.inputValue);
this.$emit("update:modelValue", +this.inputValue);
this.$emit("change", +this.inputValue);
}
父组件调用@input
可以解决这个问题

要回复问题请先登录注册