🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

react-number-input-mobile

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-number-input-mobile

React数字输入框组件

latest
Source
npmnpm
Version
0.0.10
Version published
Maintainers
1
Created
Source

React Number Input Mobile

React 移动端数字输入框组件

安装

npm install react-number-input-mobile --save

使用

import React from 'react'
import ReactDom from 'react-dom'
import NumberInput from 'react-number-input-mobile'

class Demo extends React.Component {

  render() {

    return (
      <div className="demo">
        <NumberInput 
          skin="numer-field"
          placeholder="哈哈哈"
          type="id"
          onMatch={::this.handleMatch}
          keyboard={{
            skin: 'bar',
            height: '40%'
          }}
        />
      </div>
    )

  }

}

ReactDOM.render(<Demo />, document.querySelector('#root'))

该示例已经包含在git项目中,要亲自感受,可以clone此项目,然后在项目目录执行以下命令

npm i && npm run example
open http://localhost:5998

组件属性

属性名类型说明
skinString会作为class属性附加到输入框组件的DOM元素上,可用于自定义输入框组件的样式
idString会作为id属性附加到输入框组件的DOM元素上,如果页面需要多处使用此组件,请勿传相同的值
placeholderString输入框为空时的占位文字
showCursorBoolean是否显示光标,默认true
typeString输入框类型,目前支持传入'id'(身份证号码)和'number'(普通数字),或者不传
symbolString指定键盘组件左下角按钮对应的输入字符,当指定type属性为'id'或者'number'时,symbol强制为'X'或者'.',为null时,不显示任何符号
decimalInteger小数点后的位数限制
maxLengthInteger输入的最大位数限制
maxNumber输入的最大数值限制
onChangefunction当用户输入有效值时候的回调方法,参数为输入值,在该回调中return false可以阻止用户输入
blurfunction让组件失去焦点
focusfunction让组件获得焦点
keyboardObject可以简单自定义该输入框组件对应的键盘组件
keyboard.skinString会作为class属性附加到键盘组件的DOM元素上,可用于自定义键盘组件的样式
keyboard.heightString传入一个有效的CSS高度以指定键盘组件的高度

FAQs

Package last updated on 22 Oct 2017

Did you know?

Socket

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.

Install

Related posts