0.0.2 • Published 7 years ago

password-le v0.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

弹窗组件

目录

组件介绍

password-le

使用说明

安装 password-le

npm i --save password-le

使用代码如下:

var Password = require('password-le');
var password = new Password({
    doms: "#wrapper1",//装在步骤条的容器
    onComplete: function(val){
        //输入完成的回调函数
        console.log(val);
    },
    onChange : function(val){
        //输入发生变化时的回调函数
        console.log(val);
    },
    keyStyle: 2,//是否使用非系统键盘,1使用非系统键盘,2使用系统键盘
});

结合安全键盘
//输入支付密码,调用键盘
var Keyboard = require("../../keyboard/index");
var passowrdUtil = new Password({
    doms: "#wrapper2",//装在步骤条的容器
    keyStyle: 1,  //不使用键盘
    onChange: function(){},
    onComplete: function(value){
        //输入完成,校验
        //TODO
        var keyres = Keyboard.getOutput(value);
        console.log(keyres);
    }
});

Keyboard.init({
    inputValues: [1,2,3,4,5,6,7,8,9,'.',0,'del'], //按键内容 可选,默认为 [1,2,3,4,5,6,7,8,9,'',0,'del']
    onKeyUp: function(keycode){
        var current_val = passowrdUtil.getValue();
        if(keycode=="del"){
            current_val = current_val.slice(0, -1);
        }else{
            current_val += keycode;
        }
        passowrdUtil.setValue(current_val);
    }
})