微信小程序 input 组件

  输入框:该组件是原生组件,使用的时候要注意相关的设置

  属性:

    value:类型  字符串  输入框的初始内容

    type:类型  字符串  input类型

      属性值:text  文本输入键盘

          number 数字输入键盘

          idcard 身份证输入键盘

          digit  带小数点的数字键盘

    password:类型  布尔  是否是密码类型

    placeholder:类型  字符串  输入框为空时占位符

    placeholder-style:类型  字符串  指定 placeholder 样式

    placeholder-class:类型  字符串  指定 placeholder 的样式类

    disabled:类型  布尔  是否禁用

    maxlength:类型  数字  最大输入长度,设置为-1时,不限制最大长度

    cursor-spacing:类型  数字  指定光标与键盘的距离

    focus:类型  布尔  获取焦点

    confirm-type:类型  字符串  设置键盘右下角按钮的文字,仅在 type="text' 时生效  

      属性值:send  右下角按钮为"发送"

          search  右下角按钮为"搜索"

          next   右下角按钮为"下一个"

          go   右下角按钮为"前往"

          done  右下角按钮为"完成"

   confirm-hold:类型  布尔  点击键盘右下角按钮是否保持键盘不收起

   cursor:类型  数字  指定 focus 的光标位置

   selection-start:类型  数字  光标的起始位置,自动聚焦时有效  需与 selection-end 搭配使用

   selection-end:类型  数字  光标的结束位置,自动聚焦时有效  须臾selection-start 搭配使用

   adjust-position:类型  布尔  键盘弹起时,是否自动上推页面

   

  事件:

    bindinput:  键盘输入时触发

    bindfocus:  输入框聚焦时触发

    bindblur:   输入框失去焦点时触发

    bindconfirm:   点击完成按钮时触发

       

        

猜你喜欢

转载自www.cnblogs.com/shangjun6/p/10919218.html