2.3.12 • Published 5 years ago

nuke-base-input v2.3.12

Weekly downloads
14
License
Apache-2.0
Repository
gitlab
Last release
5 years ago

BaseInput

  • category: Components
  • chinese: 基础输入框
  • type: 基本

API

Props

PropsDescriptiontypedefaultAccepted Values
multiple多行booleanfalse
type输入类型Stringtexttext date tel number
disabled是否禁用booleanfalse
readOnly是否只读Booleanfalse
maxLength最大长度,只有 type = text 才生效number-
onInput输入事件function(value, e)false
onFocusFocus 事件functionfalse
onBlurBlur 事件functionfalse
onChangechangefunction(value, e)
onReturn点击虚拟键盘右下角的键触发的事件,在 native 端使用原生事件,web 端使用 keyup 且 charCode = 13 代替。返回值 e {returnKeyType:'类型',value:'输入框的值'}function(e)false
returnKeyType虚拟键盘右下角的文案,目前只在 native 有效stringdefaultdefault go next search send done
rowsmultiple = true 时,可同时显示的行数number2
placeholderplaceholder 文本string-
placeholderColorplaceholder 颜色,仅 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);
      }
    }
2.3.12

5 years ago

2.3.11

5 years ago

2.3.10

5 years ago

2.3.9

5 years ago

2.3.8

5 years ago

2.3.7

5 years ago

2.3.6

5 years ago

2.3.5

5 years ago

2.3.4

5 years ago

2.3.3

5 years ago

2.3.2

5 years ago

2.3.1

5 years ago

2.3.0

5 years ago

2.2.29

6 years ago

2.2.28

6 years ago

2.2.27

6 years ago

2.2.26

6 years ago

2.2.24

6 years ago

2.2.23

6 years ago

2.2.21

6 years ago

2.2.19

6 years ago

2.2.18

6 years ago

2.2.17

6 years ago

2.2.16

6 years ago

2.2.14

6 years ago

2.2.13

6 years ago

2.2.11

6 years ago

2.2.10

6 years ago

2.2.8

6 years ago

2.2.7

6 years ago

2.2.6

6 years ago

2.2.4

6 years ago

2.2.3

6 years ago

2.2.2

6 years ago

2.1.10

6 years ago

2.1.9

6 years ago

2.1.6

6 years ago

2.1.3

6 years ago

2.1.1-4.3

6 years ago

2.1.1-4.2

6 years ago

2.1.1-3

6 years ago

2.1.1-2

6 years ago

2.1.1-1

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago