
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
nuke-base-input
Advanced tools
参数 | 说明 | 类型 | 默认值 | 可选值 |
---|---|---|---|---|
multiple | 多行 | boolean | false | |
type | 输入类型 | String | text | text date tel number |
disabled | 是否禁用 | boolean | false | |
readOnly | 是否只读 | Boolean | false | |
maxLength | 最大长度,只有 type = text 才生效 | number | - | |
onInput | 输入事件 | function(value, e) | false | |
onFocus | Focus 事件 | function | false | |
onBlur | Blur 事件 | function | false | |
onChange | change | function(value, e) | ||
onReturn | 点击虚拟键盘右下角的键触发的事件,在 native 端使用原生事件,web 端使用 keyup 且 charCode = 13 代替。返回值 e {returnKeyType:'类型',value:'输入框的值'} | function(e) | false | |
returnKeyType | 虚拟键盘右下角的文案,目前只在 native 有效 | string | default | default go next search send done |
rows | multiple = true 时,可同时显示的行数 | number | 2 | |
placeholder | placeholder 文本 | string | - | |
placeholderColor | placeholder 颜色,仅 native 有效 | string | '#999999' |
focus()
让 input 获得焦点
blur()
让 input 失去焦点
getValue()
获取输入框的值
setNativeFormatRule(rules) [weex 0.17+]
设置 native 中对实时输入内容格式化的规则,这个方法常用于前端无法解决的 native 双向绑定的场景。
以下 demo 给出在客户端上信用卡卡号输入时,每输入 4 个数字自动加入一个空格的场景:
const rules={
formatRule: '/(\\d{4})(?!$)/g',
formatReplace: '$1 ',
recoverRule: '/(\\s*)/g',
recoverReplace: '',
}
componentDidMount() {
if (isWeb) {
//...
} else {
setTimeout(() => {
this.refs['text-field'] && this.refs['text-field'].setNativeFormatRule(rules);
}, 500);
}
}
FAQs
We found that nuke-base-input demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.