apassword

2.0.1 • Public • Published

apassword


NPM version spm package Build Status Coverage Status

移动端密码控件。

snipshot


使用说明

  • maxlength 定义了密码长度,默认长度为 6。
  • 为了表单校验,建议同时设置 minlength
  • 可以通过 pattermtype 属性控制键盘响应。
<input type="password" class="apassword"
    pattern="\d*"
    minlength="6" maxlength="6" />
var APassword = require('apassword');
 
new APassword("input.apassword")
  .on("complete", function(value){
 
    alert(value);
 
}).render();
</script>

API

val()

获取密码。

clear()

清空密码。

focus()

让密码控件获得焦点,该行为会激活显示键盘。

blur()

让密码控件失去焦点,该行为会隐藏键盘。

Events

complete

指定位数的密码输入完成时,触发 complete 事件。

focus

密码控件活动焦点时触发 focus 事件。

blur

密码控件失去焦点时触发 blur 事件。

参考

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i apassword

      Weekly Downloads

      1

      Version

      2.0.1

      License

      none

      Last publish

      Collaborators

      • hotoo