关于 input 输入法 inputmode 属性

468 阅读1分钟

在input 设置默认英文输入

在小程序中 inputmode 有四个属性

  • text:普通文本输入,默认模式
  • digit:数字输入键盘
  • number:带小数点的数字输入键盘
  • english:提示使用英文键盘

在 H5 中有 八个属性

  • text: 普通文本输入
  • decimal: 含小数点的数字输入
  • numeric: 纯数字输入
  • tel: 电话号码输入
  • email: 电子邮件输入
  • url: URL 输入
  • search: 搜索输入
  • latin: 提示英文输入法

基本使用示例

    // H5 示例    
    <input type="text" inputmode="latin" value="" placeholder="请输入英文"  />
    // 小程序 示例    
    <input type="english" inputmode="latin" value="" placeholder="请输入英文"  />